Well, I finally figured out a way to do this, which, I think, is pretty decent. And here is what I did.
I used the Skip and Take methods in IQueryable to skip and migrate objects based on the page index.
So, I used the following code:
var empList = context.Employees.OrderBy("it.CreatedDate").Skip(pageIndex * 20 - 20).Take(20);
This is one way.
If someone thinks this is not a good solution, you can more than come up with something else that I can replace.
Updated code
At the suggestion of Yuri Tarabanko, I changed my code as follows:
var empList = context.Employees.OrderBy(x=>x.CreatedDate).Skip(pageIndex * 20 - 20).Take(20);
Thanks to those who took the time to read my question.
Thnq, nik ...
source
share