示例#1
0
        //
        // GET: /Account/Role/

        public ActionResult Index(RoleRequest request)
        {
            var result = this.AccountService.GetRoleList(request);
            return View(result);
        }
示例#2
0
        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);
            }
        }