Exemplo n.º 1
0
        public async Task <PaginatedList <JobOfferViewModel> > Handle(GetJobOffersWithPaginationQuery request, CancellationToken cancellationToken)
        {
            var companies = _jobOfferRepository.GetAllByCompany(request.CompanyId);

            if (request.CompanyId == null || companies == null)
            {
                _logger.LogWarning("Entity not found from database. Request ID: {0}", request.CompanyId);

                throw new NotFoundException(nameof(Company), request.CompanyId);
            }

            var paginatedEntities = await companies.ProjectTo <JobOfferViewModel>(_mapper.ConfigurationProvider)
                                    .PaginatedListAsync(request.PageNumber, request.PageSize, _uriService);

            return(paginatedEntities);
        }