예제 #1
0
        public async Task <IActionResult> getdata([FromQuery] advertParams advertParams)
        {
            var advertData = await _repo.GetDataAsync(advertParams);

            Response.AddPagination(advertData.CurrentPage, advertData.PageSize, advertData.TotalCount, advertData.TotalPages);
            return(Ok(advertData));
        }
예제 #2
0
        public async Task <PagedList <Advert> > GetDataAsync(advertParams advertParams)
        {
            var advertData = _context.Advert.OrderByDescending(x => x.Date).AsQueryable();

            return(await PagedList <Advert> .CreateAsync(advertData, advertParams.PageNumber, advertParams.PageSize));
        }