I'm using PagedList.MVC nuget, and it takes almost 10 seconds each time I clicked on the next button. I have seen that there are around 350,000 results in the PagedList and each time I clicked on the next button, it goes through all the results again. How should I solve this?
Here is the code.
public ActionResult Index(int? page)
{
List<Item> items;
using (var db = new DBDevEntities())
{
items= db.items.ToList();
}
var pageNumber = page ?? 1;
return View(items.ToPagedList(pageNumber, 25));
}