I am new to MVC. I am going through the following
tutorial.
I am on the portion where it calls for the following code
[HttpPost]
public ViewResult Edit(UserModel um)
{
if (!TryUpdateModel(um))
{
ViewModel.updateError = "Update Failure";
return View(um);
}
// ToDo: add persistent to DB.
_usrs.Update(um);
return View("Details", um);
}
When I attempt to use ViewModel I receive an error:
“The name ViewModel does not exist in the current context.”
Intellisense does not show ViewModel as an option.
ViewModel does not exist for a mvc 3 controller. I think what you are looking to use instead is the following:
Then in your view: