public IActionResult GetCards([FromBody] CardsQueryFilter filters) { var cards = _cardsService.GetCards(filters); var citiesDto = _mapper.Map <IEnumerable <CardsDto> >(cards); var metadata = new Metadata { TotalCount = cards.TotalCount, PageSize = cards.PageSize, CurrentPage = cards.CurrentPage, TotalPages = cards.TotalPages, HasNextPage = cards.HasNextPage, HasPreviousPage = cards.HasPreviousPage, NextPageUrl = _uriService.GetPostPaginationUri(filters, Url.RouteUrl(nameof(GetCards))).ToString(), PreviousPageUrl = _uriService.GetPostPaginationUri(filters, Url.RouteUrl(nameof(GetCards))).ToString() }; var response = new ApiResponse <IEnumerable <CardsDto> >(citiesDto) { Meta = metadata }; Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(metadata)); return(Ok(response)); }
public IEnumerable <Card> GetAll() { return(_cardsService.GetCards()); }
public async Task <IActionResult> GetCards(string name, string colorIdentity, string set, string format, string type) { return(Ok(await _cardsService.GetCards(name, colorIdentity, set, format, type))); }