Hi,
I'm just starting to play with asp.net mvc and I've got a very basic question:
If I have a view that shows information about System.Web.Mvc.ViewPage<Foo>
, how can I get the actual object when passing the form values to my Edit Action on my FooController?
By default I got this implementation of the Edit action:
public ActionResult Edit(int id, FormCollection collection)
Is there any way I could have another overload like this?
public ActionResult Edit(int id, Foo myObject)
Thanks.
EDITED:
Sorry guys, just a little bit more of background so you understand what I was thinking of doing....as I have my own framework to replay the changes I made on my entities I didn't need to re-query my entity and use the UpdateModel() method. What I ended up doing was just having a method like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Foo myObject)
{
}
I did not know but that works perfectly fine. Thanks to the answer which led me to this post: http://www.haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx