I am trying to implement this pakage
After I load the data from the DB, I store it like this:
Session["reservations"] = futureReservations.ToDictionary(x => custIndex++, x => x);
Then I am trying to get only the data I need for the current page:
public Dictionary<int, Restaurants> GetRecordsForPage(int pageNum)
{
Dictionary<int, Restaurants> reservations = (Session["reservations"] as Dictionary<int, Restaurants>);
int from = (pageNum * RecordsPerPage);
int to = from + RecordsPerPage;
return reservations
.Where(x => x.Key > from && x.Key <= to)
.ToDictionary(x => x.Key, x => x.Value);
}
The problem is that the reservations
variable stays null, even if the session info is correct. Can anyone help me figure out why?