예제 #1
0
        public async Task <PaginatedResult <ShowDto> > GetShowsAsync(GetShowsWithCastQuery query)
        {
            var totalItemsCount = await _repository.CountShowsAsync();

            var items = await _repository.GetShowsWithPagingAsync(query.PageNumber, query.PageSize);

            return(new PaginatedResult <ShowDto>(ShowsToDto(items), query.PageNumber, query.PageSize, totalItemsCount));
        }
예제 #2
0
        public async Task <IActionResult> GetShowsAsync(int pageNumber = 1, int pageSize = 100)
        {
            GetShowsWithCastQuery query;

            try
            {
                query = new GetShowsWithCastQuery(pageNumber, pageSize);
            }
            catch (ArgumentException)
            {
                return(BadRequest());
            }

            var result = await _showProvider.GetShowsAsync(query);

            return(Ok(result));
        }