public async Task <IEnumerable <OrganisationStandardVersion> > GetEPAORegisteredStandardVersions(string endPointAssessorOrganisationId, int?larsCode = null)
        {
            if (larsCode.HasValue && larsCode.Value > 0)
            {
                var versionsOfStandard = await _standardRepository.GetEpaoRegisteredStandardVersions(endPointAssessorOrganisationId, larsCode.Value);

                return(versionsOfStandard.Select(version => (OrganisationStandardVersion)version));
            }

            var versions = await _standardRepository.GetEpaoRegisteredStandardVersions(endPointAssessorOrganisationId);

            return(versions.Select(version => (OrganisationStandardVersion)version));
        }
Beispiel #2
0
        public async Task <PaginatedList <ApplicationSummaryItem> > Handle(WithdrawalApplicationsRequest request, CancellationToken cancellationToken)
        {
            _logger.LogInformation("Retrieving withdrawal applications");

            var organisationApplicationsResult = await _repository.GetWithdrawalApplications(request.OrganisationId, request.ReviewStatus, request.SortColumn, request.SortAscending,
                                                                                             request.PageSize, request.PageIndex);

            var items = Mapper.Map <IEnumerable <ApplicationListItem>, IEnumerable <ApplicationSummaryItem> >(organisationApplicationsResult.PageOfResults);

            if (items.Any())
            {
                var allEnrolledVersions = await _standardRepository.GetEpaoRegisteredStandardVersions(items.First().EndPointAssessorOrganisationId);

                foreach (var item in items)
                {
                    var enrolledVersionsForStandard = allEnrolledVersions.Where(v => v.IFateReferenceNumber == item.StandardReference).ToList();
                    item.WithdrawalType = GetWithdrawalApplicationType(item, enrolledVersionsForStandard);
                }
            }


            return(new PaginatedList <ApplicationSummaryItem>(items.ToList(),
                                                              organisationApplicationsResult.TotalCount, request.PageIndex, request.PageSize, request.PageSetSize));
        }