Example #1
0
        public CollectionWithPaginationMetadata <JobOfferDTO> GetJobOffers(ResourceParameters resourceParameters)
        {
            var jobOffersFromRepo = _jobOfferRepository.GetAllJobOffersWithFullData();

            if (resourceParameters.Search != null)
            {
                jobOffersFromRepo = ApplySearch(jobOffersFromRepo, resourceParameters.Search);
            }

            var pagedJobOffers    = new PagedList <JobOffer>(jobOffersFromRepo, resourceParameters.PageNumber, resourceParameters.PageSize);
            var jobOffersToReturn = _mapper.Map <IEnumerable <JobOfferDTO> >(pagedJobOffers);

            return(new CollectionWithPaginationMetadata <JobOfferDTO>(jobOffersToReturn, pagedJobOffers.CreateInfo()));
        }