In my update actions I am doing this:
[HttpPost]
public ActionResult Update()
{
if(Request.Form["..."])
{
}
..
}
So I am grabbing the ID of the entity, then loading it, then updating the properties based on the posted form values.
I’m using MVC2.
How should I be doing this as I read about model state but not sure how to start?
I want to refactor to make this right.
Update
My viewmodel looks like:
public class SomeViewModel
{
public User User {get; set;}
}
You should define a view model containing all the necessary information that the view will send:
and then have your controller action take this view model as parameter: