I work on this MVC 3 Razor app and usually use view models for my views.
A fair number of models of my presentation contain more information than just a specific entity with which I interact in my form. So my GET action handler will run the view model and provide each property with a given value, etc.
In my POST checker, I check if the state of the model is valid if I do not re-display the form / view with errors.
In my POST action handler, I have to copy the code from my GET action handler to redisplay the view again. How can I implement my actions with the controller so that I do not have to copy the code responsible for collecting data for the view model?
I tried to allow my handler to handle both POST and GET, but then I have input parameters that I need to deal with. My POST action handler will have a view model as an input parameter, but this will not be the case for the GET action handler.
Jbeckton
source share