public ActionResult WebGrid() { var model = new VehicleViewModel { AllVehicles = _vehicleRepository.GetAll() }; // Grab the first year. var firstYear = model.GetVehicleYearSelectList(model.AllVehicles).First().Value; model.SelectedVehicles = model.AllVehicles.Where(e => e.Year.ToString() == firstYear); return(View(model)); }
public ActionResult CascadingWebAPI() { var model = new VehicleViewModel { AllVehicles = _vehicleRepository.GetAll() }; var firstYear = model.GetVehicleYearSelectList(model.AllVehicles).First().Value; model.SelectedVehicles = model.AllVehicles.Where(e => e.Year.ToString() == firstYear); model.SelectedYear = int.Parse(firstYear); return(View(model)); }