public async Task <IActionResult> PartnershipType(Guid applicationId) { var model = new ConfirmPartnershipTypeViewModel { ApplicationId = applicationId }; var partnerTypeAnswer = await _qnaApiClient.GetAnswerByTag(applicationId, RoatpWorkflowQuestionTags.PartnershipType); if (partnerTypeAnswer != null && partnerTypeAnswer.Value != null) { model.PartnershipType = partnerTypeAnswer.Value; } PopulateGetHelpWithQuestion(model); return(View("~/Views/Roatp/WhosInControl/PartnershipType.cshtml", model)); }
public async Task <IActionResult> PartnershipTypeConfirmed(ConfirmPartnershipTypeViewModel model) { if (!ModelState.IsValid) { model.ErrorMessages = new List <ValidationErrorDetail>(); var modelErrors = ModelState.Values.SelectMany(v => v.Errors); foreach (var modelError in modelErrors) { model.ErrorMessages.Add(new ValidationErrorDetail { Field = "PartnershipType", ErrorMessage = modelError.ErrorMessage }); } return(View("~/Views/Roatp/WhosInControl/PartnershipType.cshtml", model)); } var organisationTypeAnswer = new List <Answer> { new Answer { QuestionId = RoatpYourOrganisationQuestionIdConstants.PartnershipType, Value = model.PartnershipType } }; var updateResult = await _qnaApiClient.UpdatePageAnswers(model.ApplicationId, RoatpWorkflowSequenceIds.YourOrganisation, RoatpWorkflowSectionIds.YourOrganisation.WhosInControl, RoatpWorkflowPageIds.WhosInControl.PartnershipType, organisationTypeAnswer); if (!updateResult.ValidationPassed) { return(RedirectToAction("PartnershipType", new { applicationId = model.ApplicationId })); } if (model.PartnershipType == ConfirmPartnershipTypeViewModel.PartnershipTypeIndividual) { return(RedirectToAction("AddPartner", new { applicationId = model.ApplicationId, partnerIndividual = true })); } else { return(RedirectToAction("AddPartner", new { applicationId = model.ApplicationId, partnerIndividual = false })); } }