示例#1
0
        public async Task <PagedList <PhotoDto> > GetUnapprovedPhotos(PhotoParams photoParams)
        {
            var query = _context.Photos
                        .IgnoreQueryFilters()
                        .Where(photo => !photo.IsApproved)
                        .ProjectTo <PhotoDto>(_mapper.ConfigurationProvider)
                        .AsNoTracking();

            return(await PagedList <PhotoDto>
                   .CreateAsync(query, photoParams.PageNumber, photoParams.PageSize));
        }
示例#2
0
        public async Task <ActionResult <IEnumerable <PhotoDto> > > GetPhotosForModeration(
            [FromQuery] PhotoParams photoParams)
        {
            var photos = await _unitOfWork.PhotoRepository.GetUnapprovedPhotos(photoParams);

            Response.AddPaginationHeader(photos.CurrentPage,
                                         photos.PageSize,
                                         photos.TotalCount,
                                         photos.TotalPages);
            return(photos);
        }