【发布时间】:2012-10-21 13:37:51
【问题描述】:
我有一个外键指向地址表的用户表。
public User()
{
}
public int UserID { get; set; }
public string ReferenceNumber { get; set; }
public string FirstName { get; set; }
public string SecondName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public bool IsEnabled { get; set; }
public string TelephoneNumber { get; set; }
public string FaxNumber { get; set; }
public bool IsAccountant { get; set; }
public int AddressID { get; set; }
public virtual Address Address { get; set; }
}
这在视图中工作正常,即在创建新的“用户”记录时要求用户选择 AddressID...但是,如果地址记录尚不存在(除了首先创建它)我该怎么办?可能以某种方式将它们指向地址视图,强制他们首先创建地址并将主键传回或将两个视图放在同一页面上?非常感谢。
【问题讨论】:
标签: c# asp.net asp.net-mvc entity-framework