这里我使用EntityFramework将数据插入两个不同的表中。请建议我怎么办
ClassFile的
namespace ImageWithallCtrls.Models
{
public partial class TwoTabes
{
public partial class Employee
{
public int id { get; set; }
public string Name { get; set; }
public string EMail { get; set; }
public string Password { get; set; }
public virtual ICollection<Department> Department { get; set; }
}
public class Department
{
public int DID { get; set; }
public string D_Name { get; set; }
public string Employee_Name { get; set; }
public Nullable<decimal> Salary { get; set; }
}
}
}
HomeController.cs
public ActionResult InserTwise(TwoTabes model )
{
Employee emp = db.Employees.Create();
emp.Name = model.Employee.Name;
}
我在这里遇到错误"model.Employee.Name"