public IActionResult Confirm(ConfirmViewModel viewModel) { var amendment = GetAmendment(); // Ensure steps haven't been manually skipped if (amendment == null) { return(RedirectToAction("Index", "TaskList")); } // Cancel amendment if (!viewModel.ConfirmAmendment) { // Cancel amendment ClearAmendmentAndRelated(); return(RedirectToAction("Index", "TaskList")); } try { amendment.IsUserConfirmed = true; var amendmentOutcome = _amendmentService.CreateAmendment(amendment); // Create amendment and redirect to amendment received page if (amendmentOutcome.IsComplete && amendmentOutcome.IsAmendmentCreated) { ClearAmendmentAndRelated(); var receivedViewModel = new ReceivedViewModel { NewAmendmentId = amendmentOutcome.NewAmendmentId, NewAmendmentRef = amendmentOutcome.NewAmendmentReferenceNumber }; return(RedirectToAction("Received", receivedViewModel)); } return(RedirectToAction("Prompt", "Questions")); } catch (ApiException <ProblemDetails> apiException) { var properties = apiException.Result.AdditionalProperties; dynamic titleContent = properties.Values.Last(); return(View("CustomMessage", new CustomMessageViewModel { Description = properties.Values.First().ToString(), Title = titleContent.errorMessage.ToString(), PupilDetails = new PupilViewModel(amendment.Pupil) })); } }
public IActionResult Received(ReceivedViewModel viewModel) { return(View("Received", viewModel)); }