I'm new to ASP and programing in general, so I'm probably doing something fundamentally wrong but here it goes: Everytime I return a View in my controller the model that I was using in that controller gets emptied. example:
Account acc;
public ActionResult Index()
{
acc = new Account(accountName, password);
return View(acc)
} //At this point there still is a acc object
public ActionResult Edit(string name, string pass)
{
//Here the acc object is null
acc.userName = name;
acc.password = pass;
}
My question would how to acces the account that is currently being used or a way to save the model that was send with de View()
Edit 1
When I tried using TempDate I still encounterd the same problem:
Account acc;
public ActionResult Index()
{
acc = new Account(accountName, password);
TempDate["account"] = acc;
return View(TempDate["account"])
} //TempDate contains 1 object
public ActionResult Edit(string name, string pass)
{
//TempData is empty here
TempDate["account"].userName = name;
TempDate["account"].password = pass;
Return View("Index", TempDate["account"]);
}