request.form issue
is there a way I can get values out of "Request.Fo开发者_运维百科rm["person"] so I can set some of the values to an Entity?
It's considered a best practice to avoid using the Request object with ASP.NET MVC.
ASP.NET MVC supports Model Binding, which allows your Controller's action methods to accept an object. The default binder automatically looks for Request values that match the object's properties and binds them to parameter:
public ActionResult SavePerson(Person person)
{
//Save the person object
return View();
}
You can write custom binders in cases where the default binder doesn't meet your requirements.
More on model binding: http://weblogs.asp.net/nmarun/archive/2010/02/25/asp-net-mvc-model-binding.aspx
精彩评论