我在这里的第一个问题,
在我的域中,我有名为
学生:
public class Student:Person
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserID { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public virtual ICollection<Order> Orders { get; set; }
public virtual Project Project { get; set; }
}
项目:
public class Project
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int ProjectID { get; set; }
public int ProjectNO { get; set; }
public string Module { get; set; }
public string ProjectName { get; set; }
public string ProjectDescription { get; set; }
public bool IsGroupProject { get; set; }
public decimal Budget { get; set; }
public virtual ICollection<Student> Student { get; set; }
public virtual Supervisor Supervisor { get; set; }
}
零件:
public class Component
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int ComponentID { get; set; }
public string Name { get; set; }
public string StockCode { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public virtual Order Order { get; set; }
}
命令:
public class Order
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int OrderID { get; set; }
public DateTime OrderDate { get; set; }
public bool IsCollected { get; set; }
public DateTime CollectionDate { get; set; }
public decimal OrderTotal { get; set; }
public virtual Student Student { get; set; }
public virtual ICollection<Component> Components { get; set; }
public void CheckBudget()
{
}
}
我有一个名为 requestcomponent 的视图模型
public class RequestComponent
{
[Key]
public int RequestID { get; set; }
public Student Student { get; set; }
public Project Project { get; set; }
public Component Component { get; set; }
public Order Order { get; set; }
}
我正在尝试做两件事:
1) 在视图中显示来自学生、项目、组件和订单模型的数据。2) 使用表单向视图中的学生、项目、组件和订单模型写入数据。
请你指导我。
感谢您提前提供帮助。