MVC3 how to post a list within a class in controller?

后端 未结 3 2015
傲寒
傲寒 2021-01-27 03:42

I have a class:

public class CarList
{
    public int quantity{get;set;}
    public List Cars {get;set;}
}

public class Car {
    public string Name          


        
3条回答
  •  臣服心动
    2021-01-27 04:39

    Actually you don't need to loop through the cars collection. You just have it like

    @Html.EditorFor(x => x.Cars)
    

提交回复
热议问题