tags:

views:

35

answers:

1

If i have a controller action "Create" that returns a view with the following as the Model type:

public class PaymentModel
{
        public Model.SummaryInformation SummaryInformation;

        public Model.CardDetail CardDetail;
}

If there is a button on this view that POST's to an action "New" and I want that action to recieve a different object e.g.

 public class PaymentNewModel
   {
      public Model.CardDetail CardDetail;
   }

Is this possible? I do not want to use the same Model when the view is rendered to the Model that is POSTed

A: 

I'm not aware of anything that would prevent this. The action binder doesn't really care, as long as it can figure it out.

I assume the SummaryInformation object is only used for presentation? (it does not affect the input form?) In that case, you could pass it via ViewData and just bind the view directly against the CardDetail. This is closer to the MVC philosophy, but probably not a huge deal one way or the other.

GalacticCowboy
Thanks GalacticCowboy. Used a different model for view display and controller action and it works
Noel