Two models in one view in ASP MVC 3

后端 未结 12 1902
日久生厌
日久生厌 2020-11-22 13:55

I have 2 models:

public class Person
{
    public int PersonID { get; set; }
    public string PersonName { get; set; }
}
public class Order
{
    public int         


        
12条回答
  •  花落未央
    2020-11-22 14:33

    You can use the presentation pattern http://martinfowler.com/eaaDev/PresentationModel.html

    This presentation "View" model can contain both Person and Order, this new
    class can be the model your view references.

提交回复
热议问题