public async Task <IActionResult> Index(AircraftDetailsViewModel model) { IActionResult result = null; if (ModelState.IsValid && (model.Action == ControllerActions.ActionNextPage)) { _wizard.CacheAircraftDetailsModel(model, User.Identity.Name); result = RedirectToAction("Index", "ConfirmDetails"); } else if (model.Action == ControllerActions.ActionPreviousPage) { _wizard.ClearCachedAircraftDetailsModel(User.Identity.Name); result = RedirectToAction("Index", "FlightDetails"); } else { // Set the list of available manufacturers List <Manufacturer> manufacturers = await _wizard.GetManufacturersAsync(); model.SetManufacturers(manufacturers); // Load the models for the aircraft's manufacturer if (model.ManufacturerId > 0) { List <Model> models = await _wizard.GetModelsAsync(model.ManufacturerId ?? 0); model.SetModels(models); } result = View(model); } return(result); }
public async Task <IActionResult> Models(int manufacturerId) { AircraftDetailsViewModel model = new AircraftDetailsViewModel(); List <Model> aircraftModels = await _wizard.GetModelsAsync(manufacturerId); model.SetModels(aircraftModels); return(PartialView(model)); }