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