Two models in one view in ASP MVC 3

后端 未结 12 2001
日久生厌
日久生厌 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:54

    Another option which doesn't have the need to create a custom Model is to use a Tuple<>.

    @model Tuple
    

    It's not as clean as creating a new class which contains both, as per Andi's answer, but it is viable.

提交回复
热议问题