我有这 3 个课程:
public class Product
{
public int ProductId { get; set; }
public int ClassId { get; set; }
public string Name { get; set; }
public virtual Class Class { get; set; }
}
public class Partner
{
public int PartnerId { get; set; }
public int ClassId { get; set; }
public string Name { get; set; }
public virtual Class Class { get; set; }
}
public class Price
{
public int PriceId { get; set; }
public int ClassId { get; set; }
public int ProductId { get; set; }
public int PartnerId { get; set; }
public float Cost { get; set; }
}
我有 3 个数据列表:
List<Product> products; List<Partner> partners; List<Price> prices;
如何在 MVC 视图的表格单元格中显示顶行中的合作伙伴、左列中的产品和价格(如果每个合作伙伴和产品都可用)?