List <SelectListItem> GetRoleItems() { List <SelectListItem> ProposedReturnValue = new List <SelectListItem>(); using (ContextBll ctx = new ContextBll()) { List <RoleBLL> roles = ctx.GetRoles(0, 25); foreach (RoleBLL r in roles) { SelectListItem i = new SelectListItem(); i.Value = r.RoleID.ToString(); i.Text = r.Role; ProposedReturnValue.Add(i); } } return(ProposedReturnValue); }
public ActionResult Page(int PageNumber, int PageSize) { ViewBag.PageNumber = PageNumber; ViewBag.PageSize = PageSize; List <RoleBLL> Model = new List <RoleBLL>(); try { using (ContextBll ctx = new ContextBll()) { ViewBag.TotalCount = ctx.ObtainRoleCount(); Model = ctx.GetRoles(PageNumber * PageSize, PageSize); } return(View("Index", Model)); } catch (Exception ex) { ViewBag.Exception = ex; return(View("Error")); } }