-4

I am trying to Pagination using Skip Take in Code First Approach But given Error. enter image description here

Method

 [HttpPost]
    [Route("Paging")]

    public async ActionResult<IEnumerable<City>> Paging(int CurrentPage)
    {
        CurrentPage = CurrentPage;
        return   _dropdowncontext.cities.OrderBy(x=>x.CityId).Skip((CurrentPage - 1) * 5).Take(5);
    }
user1672994
  • 10,509
  • 1
  • 19
  • 32

1 Answers1

0
[HttpPost]
[Route("Paging")]
public async Task <ActionResult<IQueryable<City>>> Paging(int CurrentPage=1)
    {
    var abc= await _dropdowncontext.cities.OrderBy(x=>x.CityId).Skip((CurrentPage - 1) * 5).Take(5).ToListAsync();

        if (!abc.Any())
            return NotFound();
        return Ok(abc);
    }