Asp.NET MVC View with different objects

Posted by user195910 on Stack Overflow See other posts from Stack Overflow or by user195910
Published on 2010-03-30T10:59:09Z Indexed on 2010/03/30 11:03 UTC
Read the original article Hit count: 222

Filed under:

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

© Stack Overflow or respective owner

Related posts about asp.net-mvc