The values you're passing to Skip
and Take
are wrong.
The argument to
Skip
should be the number of records you want to skip, which should be0
on the first page;The argument to
Take
needs to be the number of records you want to return, which will always be equal tobatch
;
Your code needs to be:
int batch = 10;
int fromRecord = 0;
int toRecord = batch;
if (page != 1)
{
fromRecord = batch * (page - 1);
}