I'm using MVC and i have a controller action which handles several different view models, each view model has validation and i'd like the controller to check the validation.
This is my controller action:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult WizardCaseResult(FormCollection fc)
{
ViewA vm = new ViewA();
TryUpdateModel<ViewA>(vm);
}
How do i change this code so that the type of view model can be set dynamically something like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult WizardCaseResult(FormCollection fc, string ViewType)
{
ViewType vm = new ViewType();
TryUpdateModel<ViewType>(vm);
}
I will probably have many different view models so a different action for each type is really out of the question.