private void InitializeRouteValueDictionary(PaginationViewModel model) { model.PageRouteValuesDictionary = new Dictionary<int, RouteValueDictionary>(); for (int i = 1; i <= model.TotalPages; i++) { InitializeDictionaryForPage(model, i); } }
public void InitializePaginationModel(PaginationViewModel model, int currentPage, int count) { if (_route != null) { model.Route = _route; } else { model.Controller = _controller; model.Action = _action; } model.CurrentPage = currentPage; model.TotalPages = model.GetPageCount(count, _pageSize); if (model.CurrentPage > model.TotalPages) { model.CurrentPage = model.TotalPages; } model.UpdateTargetId = _updateTargetId; InitializeRouteValueDictionary(model); }
private void InitializeDictionaryForPage(PaginationViewModel model, int page) { model.PageRouteValuesDictionary[page] = new RouteValueDictionary(); model.PageRouteValuesDictionary[page][UserNameKey] = _userName; model.PageRouteValuesDictionary[page][PageKey] = page.ToString(); }