我有一个这样的模型:
public class EquipmentEmployee
{
public int EquipmentEmployeeID { get; set; }
public int EmployeeID { get; set; }
public Employee Employee { get; set; }
public int EquipmentID { get; set; }
public Equipment Equipment { get; set; }
public int RequisitionID { get; set; }
public Requisition Requisition { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public string Comment { get; set; }
}
我使用 Mvc 脚手架来创建我的控制器、存储库和视图。在创建视图中我无法发布,因为我没有“to”和“RequisitionID”的值。我没有向他们添加[必需]。这可能吗?要 POST 并让这两个为空?