Never store in a plastic hard case (with or without a foam liner) unless you also have a dessicant packet in to absorb the moisture. Actually, the same applies to a gun safe too...be sure you've got something to absorb the moisture out of the air.
They don't allow airflow around the metal and any moisture that's inside when you close it up will stick around.
Same applies to the foam liner (or even the synthetic gun rugs). These will hold moisture right against the metal and it'll rust even faster. Evn if you oiled the metal before storage, the foam will rub some of it off and you'll get a mottled rust finish that matches the pattern of the foam. Not pretty!
And unless you're in a really dry environment, I would also use a thicker grease/oil or cosmoline type product to seal moisture away from the firearm if it's truly long-term storage. Short-term, like a few months or less, you can use pretty much any gun oil.
Personally, I've got several hunting rifles that regularly get a coat of automotive paste wax. Helps keep the moisture from snow/rain out in the field from starting rust. Also helps with off-season storage rust prevention too.