【发布时间】:2020-05-14 06:43:09
【问题描述】:
您好,我有一个带有 to table 的模型和一个一对多的关系 订单和状态
我想显示一个列表,其中包含所有属性的顺序和状态中的最后一个标题,根据 Order id 按顺序 我怎么能得到它? 谢谢你
这是我的代码:
namespace Pur.Models
{
using System;
using System.Collections.Generic;
public partial class Order
{
public int OrdeId { get; set; }
public Nullable<int> UserID { get; set; }
public Nullable<System.DateTime> OrderDate { get; set; }
public string Description { get; set; }
public int Quantity { get; set; }
public string Unit { get; set; }
public string Priority { get; set; }
public string Department { get; set; }
public virtual ICollection<Status> Status { get; set; }
}
}
和其他:
namespace Pur.Models
{
using System;
using System.Collections.Generic;
public partial class Status
{
public int StatusId { get; set; }
public string Title { get; set; }
public int OrderID { get; set; }
public Nullable<System.DateTime> StatusDate { get; set; }
public virtual Order Order { get; set; }
}
【问题讨论】:
-
任何人都可以帮助我吗?
标签: asp.net asp.net-mvc linq model-view-controller