public async Task <OutcomeApplicationViewModel> GetOverviewViewModel(GetOutcomeOverviewRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var sequences = await _clarificationApiClient.GetClarificationSequences(request.ApplicationId); if (application is null || contact is null || sequences is null) { return(null); } var viewmodel = new OutcomeApplicationViewModel(application, contact, sequences); var savedOutcomes = await _clarificationApiClient.GetAllClarificationPageReviewOutcomes(request.ApplicationId, request.UserId); if (!(savedOutcomes is null) && savedOutcomes.Any()) { foreach (var sequence in viewmodel.Sequences) { foreach (var section in sequence.Sections) { if (string.IsNullOrEmpty(section.Status)) { section.Status = OverviewStatusService.GetOutcomeSectionStatus(savedOutcomes, sequence.SequenceNumber, section.SectionNumber); } } } } return(viewmodel); }
public async Task <ClarifierApplicationViewModel> GetOverviewViewModel(GetClarificationOverviewRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var sequences = await _clarificationApiClient.GetClarificationSequences(request.ApplicationId); if (application is null || contact is null || sequences is null) { return(null); } var viewmodel = new ClarifierApplicationViewModel(application, contact, sequences, request.UserId); var savedOutcomes = await _clarificationApiClient.GetAllClarificationPageReviewOutcomes(request.ApplicationId, request.UserId); if (savedOutcomes is null || !savedOutcomes.Any()) { viewmodel.IsReadyForClarificationConfirmation = false; }
public async Task <ClarificationOutcomeViewModel> GetClarificationOutcomeViewModel(GetClarificationOutcomeRequest request) { var application = await _applicationApiClient.GetApplication(request.ApplicationId); var contact = await _applicationApiClient.GetContactForApplication(request.ApplicationId); var outcomes = await _clarificationApiClient.GetAllClarificationPageReviewOutcomes(request.ApplicationId, request.UserId); if (application is null || contact is null || outcomes is null) { return(null); } var unsetOutcomesCount = outcomes.Count(x => x.Status != ClarificationPageReviewStatus.Pass && x.Status != ClarificationPageReviewStatus.Fail); if (unsetOutcomesCount > 0) { return(null); } return(new ClarificationOutcomeViewModel(application, outcomes)); }