我一直在努力做一些简单的事情。我需要创建一个包含列表列表的表单。
这是我想要制作以下形式的模型:
public OrderViewModel()
{
DeliveryAddress = new ProjectDeliveryAddressViewModel();
OrderItems = new List<OrderItemView>();
}
public int ProjectDeliveryId { get; set; }
public long ProjectId { get; set; }
[Display(ResourceType = typeof(Res.ViewModels.Common), Name = "CustomerOrderNumber")]
public string CustomerOrderNumber { get; set; }
[Display(ResourceType = typeof(Res.ViewModels.Common), Name = "DeliveryDate")]
public string RequestedDeliveryDate { get; set; }
public ProjectDeliveryAddressViewModel DeliveryAddress { get; set; }
public IList<OrderItemView> OrderItems { get; set; }
}
public class OrderItemView
{
public OrderItemView()
{
Additionalitems = new List<AdditionalItem>();
}
public long ProjectItemId { get; set; }
public string ItemName { get; set; }
public string ImageData { get; set; }
public int Quantity { get; set; }
public decimal Price { get; set; }
public string AaCompany { get; set; }
public string SupplierName { get; set; }
public int SupplierModelId { get; set; }
public IList<AdditionalItem> Additionalitems { get; set; }
}
public class AdditionalItem
{
public string Name { get; set; }
public string Id { get; set; }
public bool Value { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
}
最简单的方法是什么,这样我以后可以轻松地将表单发布到我的mvc控制器上?