// // GET: /Account/Role/ public ActionResult Index(RoleRequest request) { var result = this.AccountService.GetRoleList(request); return View(result); }
public IEnumerable<Role> GetRoleList(RoleRequest request = null) { request = request ?? new RoleRequest(); using (var dbContext = new AccountDbContext()) { IQueryable<Role> roles = dbContext.Roles; if (!string.IsNullOrEmpty(request.RoleName)) { roles = roles.Where(u => u.Name.Contains(request.RoleName)); } return roles.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize); } }