public async Task <IActionResult> StartFeedback(Guid feedbackId, ConfirmDetailsViewModel vm) { if (vm.IncorrectDetailsComments != null) { await _mediator.Send(new AddAmendmentCommentCommand(feedbackId, vm.IncorrectDetailsComments)); } return(RedirectToAction("Index", "FeedbackSection1", new { feedbackId = feedbackId })); }
public async Task <IActionResult> Index(Guid feedbackId) { var details = await _mediator.Send(new GetVisitFeedbackRequest(feedbackId, true)); if (details is null) { throw new SecurityException($"Feedback ID {feedbackId} is not valid."); } if (details.Status == FeedbackStatus.Complete) { return(RedirectToAction("Index", "FeedbackComplete", new { feedbackId })); } var vm = new ConfirmDetailsViewModel(details); return(View("~/Views/Feedback/ConfirmDetails.cshtml", vm)); }
public async Task <IActionResult> Index(ConfirmDetailsViewModel viewModel) { IActionResult result = null; switch (viewModel.Action) { case ControllerActions.ActionNextPage: await _wizard.CreateSighting(User.Identity.Name); result = RedirectToAction("Index", "SightingDetails"); break; case ControllerActions.ActionPreviousPage: result = RedirectToAction("Index", "AircraftDetails"); break; default: break; } return(result); }
/// <summary> /// Construct the model to confirm sighting details /// </summary> /// <param name="userName"></param> /// <returns></returns> public async Task <ConfirmDetailsViewModel> GetConfirmDetailsModelAsync(string userName) { // Get the sighting, flight details and aircraft models and map them // into the confirm details model ConfirmDetailsViewModel model = new ConfirmDetailsViewModel(); string key = GetCacheKey(SightingDetailsKeyPrefix, userName); SightingDetailsViewModel sighting = _cache.Get <SightingDetailsViewModel>(key); _mapper.Map <SightingDetailsViewModel, ConfirmDetailsViewModel>(sighting, model); key = GetCacheKey(FlightDetailsKeyPrefix, userName); FlightDetailsViewModel flight = _cache.Get <FlightDetailsViewModel>(key); _mapper.Map <FlightDetailsViewModel, ConfirmDetailsViewModel>(flight, model); key = GetCacheKey(AircraftDetailsKeyPrefix, userName); AircraftDetailsViewModel aircraft = _cache.Get <AircraftDetailsViewModel>(key); _mapper.Map <AircraftDetailsViewModel, ConfirmDetailsViewModel>(aircraft, model); // For the location, if we have a new location specified then use that as the // location. Otherwise, look up the location by its ID if (sighting.LocationId == 0) { model.Location = sighting.NewLocation; } else { Location location = await _locations.GetLocationAsync(sighting.LocationId); model.Location = location.Name; } // Repeat the above logic for the airline if (flight.AirlineId == 0) { model.Airline = flight.NewAirline; } else { Airline airline = await _airlines.GetAirlineAsync(flight.AirlineId); model.Airline = airline.Name; } // Repeat the above logic for the manufacturer if ((aircraft.ManufacturerId ?? 0) == 0) { model.Manufacturer = aircraft.NewManufacturer; } else { int manufacturerId = aircraft.ManufacturerId ?? 0; Manufacturer manufacturer = await _manufacturers.GetManufacturerAsync(manufacturerId); model.Manufacturer = manufacturer.Name; } // Repeat the above logic for the model if ((aircraft.ModelId ?? 0) == 0) { model.Model = aircraft.NewModel; } else { int modelId = aircraft.ModelId ?? 0; Model aircraftModel = await _models.GetModelAsync(modelId); model.Model = aircraftModel.Name; } return(model); }
public async Task <IActionResult> Index() { ConfirmDetailsViewModel model = await _wizard.GetConfirmDetailsModelAsync(User.Identity.Name); return(View(model)); }