public ActionResult Index(int pid = 0, int cid = 0) { try { int take = 10; int skip = take * pid; var totalCount = UserRolebll.GetAllRoles().Count(); RoleModal objRoleModal = new RoleModal(); objRoleModal.PageID = pid; objRoleModal.Current = pid + 1; int roleid = Convert.ToInt32(Session["RoleId"]); int moduleid = Convert.ToInt32(Session["ModuleId"]); var selectRoles = UserRolebll.GetAllRoles(); List<RoleModal> listObj = selectRoles.Select(x => new RoleModal { RoleId = x.RoleId, RoleName = x.RoleName, PageID = pid, Current = pid + 1, }).OrderBy(x => x.RoleId).Skip(skip).Take(take).ToList(); if (listObj != null) { double count = Convert.ToDouble(new UserTypeBLL { }.GetPageCount()); var res = count / take; objRoleModal.Pagecount = (int)Math.Ceiling(res); } objRoleModal.Roleslist = listObj; CustomMethods.ValidateRoles("RoleAssignment"); return View(objRoleModal); } catch (Exception e) { throw e; } }