Please feel free to edit the title if it is misleading, since I am not sure if that's the correct way to ask.
I am new to ASP.NET MVC I am running into a seemly easy problem and having a hard time doing it.
What I am trying to do: I have two sets of scaffolds: View A, Controller A, Model B. and View B, Controller B, Model B.
Controller A looks like this:
public ActionResult LogIn(FormCollection formValues) { ModelA Model = new ModelA(); Model.EmailAddress = formValues["EmailAddress"]; }
I want to pass this formValues["EmailAddress"]
from controller A to controller B.
In controller B, I have:
public ActionResult Initiate(FormCollection formValues, string phone, string method) { var ModelB = new ModelB(); var ModelA = new ModelA(); ---> This is null. ModelB.Email = ModelA.EmailAddress --> This is null. var userId = ModelB.dosomething(ModelB.Email, phone, method); }
Is there away of doing that?
Session["EmailAddress"] = ModelA.EmailAddress
;dosomething()
), or calldosomething()
inLogin()
.