I try to place results of below link in a paged list:
LINQ to SQL and a running total on ordered results
I change the code slightly :
var userDocs = db.Docs.AsQueryable();
Int64 running_total = 0;
var moeen = userDocs.ToList()
.OrderBy(a => a.DocDate)
.Select(a =>
{
running_total += 1;
return new MoeenViewModel
{
Doc = a,
remain = running_total
};
}
);
return View(moeen.ToPagedList(1, 15));
but 'remain' results don't start with 1. it start with 8 for example if 'Docs' records count is 7
Why ??? !!!
if I return View(moeen) results is Ok