public async Task <IActionResult> Feedback(Guid applicationId, int sequenceNo, int sectionNo, string pageId, string feedbackMessage, BackViewModel backViewModel) { var application = await _applyApiClient.GetApplication(applicationId); var section = await _qnaApiClient.GetSectionBySectionNo(application.ApplicationId, sequenceNo, sectionNo); var errorMessages = new Dictionary <string, string>(); if (string.IsNullOrWhiteSpace(feedbackMessage)) { errorMessages["FeedbackMessage"] = "Please enter a feedback comment"; } if (errorMessages.Any()) { foreach (var error in errorMessages) { ModelState.AddModelError(error.Key, error.Value); } var page = await _qnaApiClient.GetPage(application.ApplicationId, section.Id, pageId); var pageVm = new PageViewModel(applicationId, sequenceNo, sectionNo, pageId, section, page, backViewModel.BackAction, backViewModel.BackController, backViewModel.BackOrganisationId); return(View(nameof(Page), pageVm)); } var feedback = new QnA.Api.Types.Page.Feedback { Id = Guid.NewGuid(), Message = feedbackMessage, From = "Staff member", Date = DateTime.UtcNow, IsNew = true }; await _qnaApiClient.UpdateFeedback(application.ApplicationId, section.Id, pageId, feedback); return(RedirectToAction(nameof(Section), new { applicationId, backViewModel.BackAction, backViewModel.BackController, sequenceNo, sectionNo, backViewModel.BackOrganisationId })); }
public async Task <IActionResult> Section(Guid Id, int sequenceNo, int sectionNo) { var section = await _qnaApiClient.GetSectionBySectionNo(Id, sequenceNo, sectionNo); var applicationSection = new ApplicationSection { Section = section, Id = Id }; applicationSection.SequenceNo = sequenceNo; applicationSection.PageContext = OrganisationName; switch (section?.DisplayType) { case null: case SectionDisplayType.Pages: return(View("~/Views/Application/Section.cshtml", applicationSection)); case SectionDisplayType.Questions: return(View("~/Views/Application/Section.cshtml", applicationSection)); case SectionDisplayType.PagesWithSections: return(View("~/Views/Application/PagesWithSections.cshtml", applicationSection)); default: throw new BadRequestException("Section does not have a valid DisplayType"); } }
public async Task <IActionResult> Download(Guid Id, int sequenceNo, int sectionId, string pageId, string questionId, string filename) { var selectedSection = await _qnaApiClient.GetSectionBySectionNo(Id, sequenceNo, sectionId); var response = await _qnaApiClient.DownloadFile(Id, selectedSection.Id, pageId, questionId, filename); var fileStream = await response.Content.ReadAsStreamAsync(); return(File(fileStream, response.Content.Headers.ContentType.MediaType, filename)); }
public async Task <IActionResult> AddPartnerDetails(AddEditPeopleInControlViewModel model) { var errorMessages = PeopleInControlValidator.Validate(model); if (errorMessages.Any()) { model.ErrorMessages = errorMessages; return(View("~/Views/Roatp/WhosInControl/AddPartner.cshtml", model)); } var whosInControlSection = await _qnaApiClient.GetSectionBySectionNo(model.ApplicationId, RoatpWorkflowSequenceIds.YourOrganisation, RoatpWorkflowSectionIds.YourOrganisation.WhosInControl); var partnerTableData = await _tabularDataRepository.GetTabularDataAnswer(model.ApplicationId, RoatpWorkflowQuestionTags.AddPartners); if (partnerTableData == null) { partnerTableData = new TabularData { HeadingTitles = new List <string> { "Name", "Date of birth" }, DataRows = new List <TabularDataRow>() }; } var partnerData = new TabularDataRow { Id = Guid.NewGuid().ToString(), Columns = new List <string> { model.PersonInControlName } }; if (!model.DateOfBirthOptional) { partnerData.Columns.Add(DateOfBirthFormatter.FormatDateOfBirth(model.PersonInControlDobMonth, model.PersonInControlDobYear)); } else { partnerData.Columns.Add(string.Empty); } partnerTableData.DataRows.Add(partnerData); var result = await _tabularDataRepository.SaveTabularDataAnswer( model.ApplicationId, whosInControlSection.Id, RoatpWorkflowPageIds.WhosInControl.AddPartners, RoatpYourOrganisationQuestionIdConstants.AddPartners, partnerTableData); return(RedirectToAction("ConfirmPartners", new { applicationId = model.ApplicationId })); }
public async Task <IActionResult> DownloadFiles(Guid orgId, Guid applicationId) { // NOTE: Using the QnA applicationId is somewhat dubious! We're using the Assessor applicationId nearly everywhere else. var financialSection = await _qnaApiClient.GetSectionBySectionNo(applicationId, ApplyConst.FINANCIAL_SEQUENCE_NO, ApplyConst.FINANCIAL_DETAILS_SECTION_NO); var organisation = await _apiClient.GetOrganisation(orgId); if (financialSection != null && organisation != null) { using (var zipStream = new MemoryStream()) { using (var zipArchive = new ZipArchive(zipStream, ZipArchiveMode.Create, true)) { var pagesContainingQuestionsWithFileupload = financialSection.QnAData.Pages.Where(x => x.Questions.Any(y => y.Input.Type == "FileUpload")).ToList(); foreach (var uploadPage in pagesContainingQuestionsWithFileupload) { foreach (var uploadQuestion in uploadPage.Questions) { foreach (var answer in financialSection.QnAData.Pages.SelectMany(p => p.PageOfAnswers).SelectMany(a => a.Answers).Where(a => a.QuestionId == uploadQuestion.QuestionId)) { if (string.IsNullOrWhiteSpace(answer.ToString())) { continue; } var fileDownloadName = answer.Value; var downloadedFile = await _qnaApiClient.DownloadFile(applicationId, financialSection.Id, uploadPage.PageId, uploadQuestion.QuestionId, fileDownloadName); if (downloadedFile.IsSuccessStatusCode) { var zipEntry = zipArchive.CreateEntry(fileDownloadName); using (var entryStream = zipEntry.Open()) { var fileStream = await downloadedFile.Content.ReadAsStreamAsync(); fileStream.CopyTo(entryStream); } } } } } } zipStream.Position = 0; return(File(zipStream.ToArray(), "application/zip", $"FinancialDocuments_{organisation.EndPointAssessorName}.zip")); } } return(new NotFoundResult()); }
private async Task <Section> GetParentCompanySection(Guid applicationId) { const string ParentCompanySectionTitle = "UK ultimate parent company"; Section parentCompanySection = null; var hasParentCompanyTagValue = await _qnaApiClient.GetQuestionTag(applicationId, RoatpQnaConstants.QnaQuestionTags.HasParentCompany); if ("Yes".Equals(hasParentCompanyTagValue, StringComparison.OrdinalIgnoreCase)) { parentCompanySection = await _qnaApiClient.GetSectionBySectionNo(applicationId, RoatpQnaConstants.RoatpSequences.YourOrganisation, RoatpQnaConstants.RoatpSections.YourOrganisation.OrganisationDetails); parentCompanySection.LinkTitle = ParentCompanySectionTitle; parentCompanySection.Title = ParentCompanySectionTitle; parentCompanySection.QnAData.Pages = parentCompanySection.QnAData.Pages?.Where(page => page.PageId == RoatpQnaConstants.RoatpSections.YourOrganisation.PageIds.ParentCompanyCheck || page.PageId == RoatpQnaConstants.RoatpSections.YourOrganisation.PageIds.ParentCompanyDetails) .ToList(); // This is a workaround for a single issue of layout. If any more go in, needs to be converted to a service // also contains code to remove an empty answer const string companyOrCharityNumberQuestionId = "YO-21"; if (parentCompanySection?.QnAData?.Pages != null) { var removeQuestions = new List <QnA.Api.Types.Page.Question>(); foreach (var question in parentCompanySection.QnAData.Pages.SelectMany(page => page.Questions.Where(question => question.QuestionId == companyOrCharityNumberQuestionId))) { question.Label = "Company or charity number"; removeQuestions.Add(question); } foreach (var parentCompanyDetails in parentCompanySection.QnAData.Pages.Where(page => page.PageId == RoatpQnaConstants.RoatpSections.YourOrganisation.PageIds.ParentCompanyDetails)) { foreach (var x in from poa in parentCompanyDetails.PageOfAnswers from x in poa.Answers.Where(x => x.QuestionId == companyOrCharityNumberQuestionId) where string.IsNullOrEmpty(x.Value) select x) { foreach (var page in parentCompanySection.QnAData.Pages) { page.Questions.RemoveAll(pageToRemove => removeQuestions.Contains(pageToRemove)); } } } } } return(parentCompanySection); }
private async Task <Section> GetParentCompanySection(Guid applicationId) { const string ParentCompanySectionTitle = "UK ultimate parent company"; Section parentCompanySection = null; var hasParentCompanyTagValue = await _qnaApiClient.GetQuestionTag(applicationId, RoatpQnaConstants.QnaQuestionTags.HasParentCompany); if ("Yes".Equals(hasParentCompanyTagValue, StringComparison.OrdinalIgnoreCase)) { parentCompanySection = await _qnaApiClient.GetSectionBySectionNo(applicationId, RoatpQnaConstants.RoatpSequences.YourOrganisation, RoatpQnaConstants.RoatpSections.YourOrganisation.OrganisationDetails); parentCompanySection.LinkTitle = ParentCompanySectionTitle; parentCompanySection.Title = ParentCompanySectionTitle; parentCompanySection.QnAData.Pages = parentCompanySection.QnAData.Pages?.Where(page => page.PageId == RoatpQnaConstants.RoatpSections.YourOrganisation.PageIds.ParentCompanyCheck || page.PageId == RoatpQnaConstants.RoatpSections.YourOrganisation.PageIds.ParentCompanyDetails).ToList(); } return(parentCompanySection); }
public async Task <string> FinishSectionStatus(Guid applicationId, int sectionId, IEnumerable <ApplicationSequence> applicationSequences, bool applicationSequencesCompleted) { if (!applicationSequencesCompleted) { return(TaskListSectionStatus.Blank); } var finishSequence = applicationSequences.FirstOrDefault(x => x.SequenceId == RoatpWorkflowSequenceIds.Finish); var notRequiredOverrides = await _notRequiredOverridesService.GetNotRequiredOverridesAsync(applicationId); if (notRequiredOverrides != null && notRequiredOverrides.Any(condition => condition.AllConditionsMet && sectionId == condition.SectionId && finishSequence.SequenceId == condition.SequenceId)) { return(TaskListSectionStatus.NotRequired); } var finishSection = await _qnaApiClient.GetSectionBySectionNo(applicationId, RoatpWorkflowSequenceIds.Finish, sectionId); var sectionPages = finishSection.QnAData.Pages.Count(); var completedCount = 0; var pagesWithAnswers = 0; foreach (var page in finishSection.QnAData.Pages) { if (page.PageOfAnswers != null && page.PageOfAnswers.Any()) { pagesWithAnswers++; var pageofAnswers = page.PageOfAnswers.FirstOrDefault(); foreach (var answer in pageofAnswers.Answers) { if (answer.Value == ConfirmedAnswer) { completedCount++; } } } } if (completedCount == sectionPages) { return(TaskListSectionStatus.Completed); } if (completedCount < sectionPages && pagesWithAnswers > 0) { return(TaskListSectionStatus.InProgress); } return(TaskListSectionStatus.Next); }
public async Task <string> GetBackNavigationPageId(Guid applicationId, int sequenceId, int sectionId, string pageId) { string previousPageId = string.Empty; var currentSection = await _qnaApiClient.GetSectionBySectionNo(applicationId, sequenceId, sectionId); var firstPageInSection = currentSection.QnAData.Pages[0]; if (pageId == firstPageInSection.PageId) { return(null); } var applicationPageHistory = _sessionService.Get <Stack <string> >(ApplicationHistoryKey); if (applicationPageHistory == null) { return(null); } while (applicationPageHistory.Count > 0) { previousPageId = applicationPageHistory.Pop(); if (previousPageId != pageId) { _sessionService.Set(ApplicationHistoryKey, applicationPageHistory); break; } } if (previousPageId == pageId) { return(null); } return(previousPageId); }
public async Task <IActionResult> TrusteesDobsConfirmed(ConfirmTrusteesDateOfBirthViewModel model) { var answers = _answerFormService.GetAnswersFromForm(HttpContext); var trusteesData = await _tabularDataRepository.GetTabularDataAnswer(model.ApplicationId, RoatpWorkflowQuestionTags.CharityCommissionTrustees); trusteesData = MapAnswersToTrusteesDob(trusteesData, answers); model.TrusteeDatesOfBirth = MapTrusteesDataToViewModel(trusteesData); if (model.TrusteeDatesOfBirth.Count == 0) { return(RedirectToAction("AddPeopleInControl", new { model.ApplicationId })); } model.ErrorMessages = TrusteeDateOfBirthValidator.ValidateTrusteeDatesOfBirth(trusteesData, answers); if (model.ErrorMessages != null & model.ErrorMessages.Count > 0) { return(View("~/Views/Roatp/WhosInControl/ConfirmTrusteesDob.cshtml", model)); } var whosInControlSection = await _qnaApiClient.GetSectionBySectionNo(model.ApplicationId, RoatpWorkflowSequenceIds.YourOrganisation, RoatpWorkflowSectionIds.YourOrganisation.WhosInControl); var trusteeAnswers = new List <Answer> { new Answer { QuestionId = RoatpYourOrganisationQuestionIdConstants.CharityCommissionTrustees, Value = JsonConvert.SerializeObject(trusteesData) }, new Answer { QuestionId = RoatpYourOrganisationQuestionIdConstants.CharityCommissionDetailsConfirmed, Value = "Y" } }; var updateResult = await _qnaApiClient.UpdatePageAnswers(model.ApplicationId, RoatpWorkflowSequenceIds.YourOrganisation, RoatpWorkflowSectionIds.YourOrganisation.WhosInControl, RoatpWorkflowPageIds.WhosInControl.CharityCommissionStartPage, trusteeAnswers); return(RedirectToAction("TaskList", "RoatpApplication", new { model.ApplicationId })); }
public async Task <IActionResult> Index(Guid?applicationId, int sequenceId, int sectionId, string pageId, string title, string getHelp, string controller, string action) { var getHelpQuery = new GetHelpWithQuestion(); var errorMessageKey = string.Format(GetHelpErrorMessageKey, pageId); if (string.IsNullOrWhiteSpace(getHelp)) { _sessionService.Set(errorMessageKey, MinLengthErrorMessage); var questionKey = string.Format(GetHelpQuestionKey, pageId); _sessionService.Set(questionKey, string.Empty); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); } if (getHelp.Length > GetHelpTextMaxLength) { _sessionService.Set(errorMessageKey, MaxLengthErrorMessage); var questionKey = string.Format(GetHelpQuestionKey, pageId); _sessionService.Set(questionKey, getHelp); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); } if (applicationId.HasValue && applicationId.Value != Guid.Empty) { if (sequenceId > 0 && sectionId > 0) { var page = await _qnaApiClient.GetPageBySectionNo(applicationId.Value, sequenceId, sectionId, pageId); if (page == null || string.IsNullOrEmpty(page.Title)) { getHelpQuery.PageTitle = title; } else { getHelpQuery.PageTitle = page.Title; } var sequenceConfig = _taskListConfiguration.FirstOrDefault(x => x.Id == sequenceId); if (sequenceConfig != null) { getHelpQuery.ApplicationSequence = sequenceConfig.Title; } var currentSection = await _qnaApiClient.GetSectionBySectionNo(applicationId.Value, sequenceId, sectionId); if (currentSection != null) { getHelpQuery.ApplicationSection = currentSection.Title; } } else { getHelpQuery.PageTitle = title; getHelpQuery.ApplicationSequence = "Not available"; getHelpQuery.ApplicationSection = "Not available"; } var organisationName = await _qnaApiClient.GetAnswerByTag(applicationId.Value, RoatpWorkflowQuestionTags.UkrlpLegalName); if (organisationName != null && !string.IsNullOrWhiteSpace(organisationName.Value)) { getHelpQuery.OrganisationName = organisationName.Value; } else { getHelpQuery.OrganisationName = "Not available"; } var organisationUKPRN = await _qnaApiClient.GetAnswerByTag(applicationId.Value, RoatpWorkflowQuestionTags.UKPRN); if (organisationUKPRN != null && !string.IsNullOrWhiteSpace(organisationUKPRN.Value)) { getHelpQuery.UKPRN = organisationUKPRN.Value; } else { getHelpQuery.UKPRN = "Not available"; } } else { // in preamble so we don't have an application set up yet var applicationDetails = _sessionService.Get <ApplicationDetails>(ApplicationDetailsKey); getHelpQuery.PageTitle = title; getHelpQuery.ApplicationSequence = "Preamble"; getHelpQuery.ApplicationSection = "Preamble"; var ukprn = applicationDetails?.UKPRN.ToString(); if (string.IsNullOrWhiteSpace(ukprn)) { ukprn = "Not available"; } getHelpQuery.UKPRN = ukprn; var organisationName = applicationDetails?.UkrlpLookupDetails?.ProviderName; if (string.IsNullOrWhiteSpace(organisationName)) { organisationName = "Not available"; } getHelpQuery.OrganisationName = organisationName; } getHelpQuery.GetHelpQuery = getHelp; var userDetails = await _usersApiClient.GetUserBySignInId(User.GetSignInId()); getHelpQuery.EmailAddress = userDetails.Email; getHelpQuery.ApplicantFullName = $"{userDetails.GivenNames} {userDetails.FamilyName}"; await _emailService.SendGetHelpWithQuestionEmail(getHelpQuery); var sessionKey = string.Format(GetHelpSubmittedForPageKey, pageId); _sessionService.Set(sessionKey, true); _sessionService.Set(errorMessageKey, string.Empty); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); }
public async Task <IActionResult> AddManagementHierarchyDetails(AddEditManagementHierarchyViewModel model) { if (!ModelState.IsValid) { return(View("~/Views/Roatp/ManagementHierarchy/AddManagementHierarchy.cshtml", model)); } var managementHierarchySection = await _qnaApiClient.GetSectionBySectionNo(model.ApplicationId, RoatpWorkflowSequenceIds.DeliveringApprenticeshipTraining, RoatpWorkflowSectionIds.DeliveringApprenticeshipTraining.ManagementHierarchy); var managementHierarchyData = await _tabularDataRepository.GetTabularDataAnswer(model.ApplicationId, RoatpWorkflowQuestionTags.AddManagementHierarchy); var managementHierarchyPerson = new TabularDataRow { Id = Guid.NewGuid().ToString(), Columns = new List <string> { model.FirstName, model.LastName, model.JobRole, model.TimeInRoleYears, model.TimeInRoleMonths, model.IsPartOfOtherOrgThatGetsFunding, model.IsPartOfOtherOrgThatGetsFunding == "Yes" ? model.OtherOrgName : string.Empty, model.DobMonth, model.DobYear, model.Email, model.ContactNumber } }; if (managementHierarchyData == null) { managementHierarchyData = new TabularData { HeadingTitles = new List <string> { "First Name", "Last Name", "Job role", "Years in role", "Months in role", "Part of another organisation", "Organisation details", "Month", "Year", "Email", "Contact number" }, DataRows = new List <TabularDataRow> { managementHierarchyPerson } }; var result = await _tabularDataRepository.SaveTabularDataAnswer( model.ApplicationId, managementHierarchySection.Id, RoatpWorkflowPageIds.ManagementHierarchy.AddManagementHierarchy, RoatpDeliveringApprenticeshipTrainingQuestionIdConstants.ManagementHierarchy, managementHierarchyData); } else { var result = await _tabularDataRepository.UpsertTabularDataRecord( model.ApplicationId, managementHierarchySection.Id, RoatpWorkflowPageIds.ManagementHierarchy.AddManagementHierarchy, RoatpDeliveringApprenticeshipTrainingQuestionIdConstants.ManagementHierarchy, RoatpWorkflowQuestionTags.AddManagementHierarchy, managementHierarchyPerson); } return(RedirectToAction("ConfirmManagementHierarchy", new { model.ApplicationId })); }
public async Task <IActionResult> Index(Guid?applicationId, int sequenceId, int sectionId, string pageId, string title, string getHelp, string controller, string action) { var errorMessageKey = string.Format(GetHelpErrorMessageKey, pageId); if (string.IsNullOrWhiteSpace(getHelp)) { _sessionService.Set(errorMessageKey, MinLengthErrorMessage); var questionKey = string.Format(GetHelpQuestionKey, pageId); _sessionService.Set(questionKey, string.Empty); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); } if (getHelp.Length > GetHelpTextMaxLength) { _sessionService.Set(errorMessageKey, MaxLengthErrorMessage); var questionKey = string.Format(GetHelpQuestionKey, pageId); _sessionService.Set(questionKey, getHelp); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); } var sequenceConfig = _taskListConfiguration.FirstOrDefault(x => x.Id == sequenceId); var getHelpQuery = new GetHelpWithQuestion { ApplicationSequence = sequenceConfig?.Title ?? $"Not available (Sequence {sequenceId})", ApplicationSection = $"Not available (Section {sectionId}))", PageTitle = title ?? action, OrganisationName = "Not available", UKPRN = "Not available", CompanyNumber = "Not available", CharityNumber = "Not available", }; if (applicationId.HasValue && applicationId.Value != Guid.Empty) { try { var qnaApplicationData = await _qnaApiClient.GetApplicationData(applicationId.Value); var organisationName = qnaApplicationData.GetValue(RoatpWorkflowQuestionTags.UkrlpLegalName)?.Value <string>(); if (!string.IsNullOrWhiteSpace(organisationName)) { getHelpQuery.OrganisationName = organisationName; } var organisationUKPRN = qnaApplicationData.GetValue(RoatpWorkflowQuestionTags.UKPRN)?.Value <string>(); if (!string.IsNullOrWhiteSpace(organisationUKPRN)) { getHelpQuery.UKPRN = organisationUKPRN; } var organisationCompanyNumber = qnaApplicationData.GetValue(RoatpWorkflowQuestionTags.UKRLPVerificationCompanyNumber)?.Value <string>(); if (!string.IsNullOrWhiteSpace(organisationCompanyNumber)) { getHelpQuery.CompanyNumber = organisationCompanyNumber; } var organisationCharityNumber = qnaApplicationData.GetValue(RoatpWorkflowQuestionTags.UKRLPVerificationCharityRegNumber)?.Value <string>(); if (!string.IsNullOrWhiteSpace(organisationCharityNumber)) { getHelpQuery.CharityNumber = organisationCharityNumber; } var currentSection = await _qnaApiClient.GetSectionBySectionNo(applicationId.Value, sequenceId, sectionId); if (!string.IsNullOrEmpty(currentSection?.Title)) { getHelpQuery.ApplicationSection = currentSection.Title; } var currentPage = currentSection?.QnAData.Pages.FirstOrDefault(pg => pg.PageId == pageId); if (!string.IsNullOrEmpty(currentPage?.Title)) { getHelpQuery.PageTitle = currentPage.Title; } } catch (ApplyService.Infrastructure.Exceptions.ApiClientException apiEx) { // Safe to ignore any QnA issues. We just want to send help with as much info as possible. _logger.LogError(apiEx, $"Unable to retrieve QNA details for application : {applicationId.Value}"); } catch (NullReferenceException nullRefEx) { // Safe to ignore any QnA issues. We just want to send help with as much info as possible. _logger.LogError(nullRefEx, $"QNA details were not found for application: {applicationId.Value}"); } } else { // in preamble so we don't have an application set up yet getHelpQuery.ApplicationSequence = "Preamble"; getHelpQuery.ApplicationSection = "Preamble"; var applicationDetails = _sessionService.Get <ApplicationDetails>(ApplicationDetailsKey); if (applicationDetails != null) { getHelpQuery.UKPRN = applicationDetails.UKPRN.ToString(); var organisationName = applicationDetails.UkrlpLookupDetails?.ProviderName; if (!string.IsNullOrWhiteSpace(organisationName)) { getHelpQuery.OrganisationName = organisationName; } var organisationCompanyNumber = applicationDetails.UkrlpLookupDetails?.VerificationDetails?.FirstOrDefault(x => x.VerificationAuthority == Domain.Ukrlp.VerificationAuthorities.CompaniesHouseAuthority)?.VerificationId; if (!string.IsNullOrWhiteSpace(organisationCompanyNumber)) { getHelpQuery.CompanyNumber = organisationCompanyNumber; } var organisationCharityNumber = applicationDetails.UkrlpLookupDetails?.VerificationDetails?.FirstOrDefault(x => x.VerificationAuthority == Domain.Ukrlp.VerificationAuthorities.CharityCommissionAuthority)?.VerificationId; if (!string.IsNullOrWhiteSpace(organisationCharityNumber)) { getHelpQuery.CharityNumber = organisationCharityNumber; } } } getHelpQuery.GetHelpQuery = getHelp; var userDetails = await _usersApiClient.GetUserBySignInId(User.GetSignInId()); getHelpQuery.EmailAddress = userDetails.Email; getHelpQuery.ApplicantFullName = $"{userDetails.GivenNames} {userDetails.FamilyName}"; await _emailService.SendGetHelpWithQuestionEmail(getHelpQuery); var sessionKey = string.Format(GetHelpSubmittedForPageKey, pageId); _sessionService.Set(sessionKey, true); _sessionService.Set(errorMessageKey, string.Empty); return(RedirectToAction(action, controller, new { applicationId, sequenceId, sectionId, pageId })); }