嗨,我有三个类作为进入数据库的对象。
public class Employees
{
public int Id { get; set;}
public string Name { get; set;}
public string SocialSecurityNumber{ get; set;}
public DateTime DateOfBirth { get; set;}
}
public class Education
{
public int Id { get; set;}
public string EmployeeId { get; set;}
public string EducationLevel{ get; set;} // this will be a drop down list
public string University { get; set;}
public string FieldOfStudy { get; set;}
}
public class Experience
{
public int Id { get; set;}
public int EmployeeId { get; set;}
public string Employer{ get; set;}
public DateTime From { get; set;}
public DateTime To { get; set;}
public string JobRole { get; set;}
}
然后我将 DBContext 类定义为:
public class AppDb : DbContext
{
public DbSet<Employee>Employees{ get; set;}
public DbSet<Education> Educations { get; set;}
public DbSet<Experience> Experiences {get; set;}
}
我的应用程序现在需要做的是在主页上提供一个 Create Employee 表单,让用户填写与他有关的所有详细信息。那是在主页/索引视图中以单一形式针对员工对象的员工详细信息、教育和经验。
任何帮助将不胜感激。