示例#1
0
        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));
        }
示例#2
0
        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));
        }