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)); }
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)); }