public async Task <ActionResult <PagedResponse <CarePackageApprovableListItemResponse> > > GetApprovedPackages( [FromQuery] ApprovableCarePackagesQueryParameters queryParameters, [FromServices] IGetApprovableCarePackagesUseCase useCase) { var result = await useCase.GetListAsync(queryParameters); Response.AddPaginationHeaders(result.PagingMetaData); return(Ok(result.ToPagedResponse(items => items.ToResponse()))); }
public async Task <PagedList <CarePackageApprovableListItemDomain> > GetListAsync(ApprovableCarePackagesQueryParameters parameters) { return(await _gateway.GetApprovablePackagesAsync(parameters, new[] { PackageStatus.SubmittedForApproval, PackageStatus.NotApproved, PackageStatus.Approved })); }
public async Task <PagedList <CarePackageApprovableListItemDomain> > GetApprovablePackagesAsync(ApprovableCarePackagesQueryParameters parameters, PackageStatus[] statusesToInclude) { var query = _dbContext.CarePackages .FilterApprovableCarePackages( parameters.ServiceUserId, parameters.ServiceUserName, parameters.PackageStatus, parameters.PackageType, parameters.ApproverId, parameters.FromDate, parameters.ToDate, statusesToInclude); var packages = await query .Include(cp => cp.ServiceUser) .Include(cp => cp.Approver) .OrderBy(cp => cp.Status) .GetPage(parameters.PageNumber, parameters.PageSize) .AsNoTracking() .ToListAsync(); var totalPackagesCount = await query.CountAsync(); var pagedList = PagedList <CarePackageApprovableListItemDomain> .ToPagedList( packages.ToApprovableListItemDomain(), totalPackagesCount, parameters.PageNumber, parameters.PageSize); return(pagedList); }