public ActionResult Messages(int p = 1) { UserModel userModel = new UserModel(); var userMails = userModel.GetUserMessages(User.Identity.Name); int msgCount = userMails.Count(); ViewBag.MessagesCount = msgCount; int pageSize = 15; Paging.ToPaging(p, msgCount, this, pageSize); userMails = userMails.Skip((p - 1) * pageSize).Take(pageSize); ViewBag.PageName = "msg"; return View(userMails); }