示例#1
0
        public async Task <IActionResult> GetQuotes([FromQuery] QuoteParams quoteParams)
        {
            var quotes = await _quoteRepo.GetQuotes(quoteParams);

            var quoteToReturn = _mapper.Map <IEnumerable <QuoteDto> >(quotes);

            Response.AddPagination(quotes.CurrentPage, quotes.PageSize,
                                   quotes.TotalCount, quotes.TotalPages);
            return(Ok(quoteToReturn));
        }
        public async Task <PagedList <Quote> > GetQuotes(QuoteParams quoteParams)
        {
            var quotes = _Context.Quotes.OrderByDescending(q => q.QuoteDate);

            return(await PagedList <Quote> .CreateAsync(quotes, quoteParams.PageNumber, quoteParams.PageSize));
        }