예제 #1
0
        public RoleSearchDtoOutput GetAll(RoleSearchDtoInput input)
        {
            if (input == null)
            {
                input = new RoleSearchDtoInput();
            }

            Logger.Info(" 查询角色信息,查询内容: " + input);
            var roleall = _roleRepository.GetAllList();
            var total   = roleall.Count;

            roleall.WhereIf(!string.IsNullOrWhiteSpace(input.RoleName), r => r.RoleName.Contains(input.RoleName));
            if (roleall == null)
            {
                throw new UserFriendlyException("未查询到数据。");
            }
            Mapper.CreateMap <Core.System.Role, RoleDto>();
            var rows = roleall.MapTo <List <RoleDto> >();

            rows = rows.Skip(input.Offset).Take(input.Limit).ToList();

            return(new RoleSearchDtoOutput {
                Total = total, Rows = rows
            });
        }
예제 #2
0
        public ActionResult IndexList(RoleSearchDtoInput input)
        {
            var data = _roleService.GetAll(input);

            return(Json(data));
        }