I have the following object:
public class CarModelList
{
public List<CarModel> CarsList { get; set; }
}
The CarModel is as follows:
public class CarModel
{
public long Id { get; set; }
public string Color { get; set; }
public List<SelectItem> ColorList { get; set; }
public string Seats { get; set; }
public string Model { get; set; }
public string Year { get; set; }
}
I have a view which on loading first displays 3 checkboxes
: Sea, Air, Soil.
If one checkbox
is checked a tab is shown with the CarModel
properties.
Depending on the checkboxes checked(Sea, Air or Soil), different CarModel
properties will be displayed. For eg, if Air is checked the Seats will not be shown
or if Sea is checked the Model is not shown.
The properties of the different CarModel
ar shown in tabs. So if Sea is checked then the CarModel properties will be displayed in a tab excluding the Model property.
Then when Air is checked another tab is open to display the properties of the CarModel
excluding the Seats property.
In my view I have only one submit button to save the CarModel
.
So I thought of creating a Model containing a list of CarModel for the display and saving. Thus upon checking a new checkbox, the new CarModel is added to the list, CarModelList
.
Any idea of how to proceed with the saving and validation
of this CarModelList
?