Beispiel #1
0
        public ResponseInfoModel List([FromUri] GetRoleListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize = _systemConfigurationService.GetPageSize();
                int limit    = pageSize;
                int offset   = pageSize * (input.PageIndex - 1);
                int total;
                var roleList = _roleService.GetPageList(limit, offset, out total, a => string.IsNullOrEmpty(input.Keywords) || (a.RoleName.Contains(input.Keywords)), true, a => a.OrderID).ToList();
                var list     = roleList.MapTo <List <GetRoleListOutput> >();
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = list
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/role/list", LocalizationConst.QueryFail);
            }
            return(json);
        }
Beispiel #2
0
        public async Task <ListResultOutput <GetRoleListDto> > GetRoleListAsync(GetRoleListInput input)
        {
            var list = await _roleRepository.GetAll()
                       .OrderBy(input)
                       .ToListAsync();

            return(new ListResultOutput <GetRoleListDto>(list.MapTo <List <GetRoleListDto> >()));
        }
        public async Task <PagedResultDto <IdentityRoleDto> > ListAsync(GetRoleListInput input)
        {
            var request = new GetIdentityRolesInput();

            request.Filter         = input.filter?.Trim();
            request.MaxResultCount = input.PageSize;
            request.SkipCount      = (input.PageIndex - 1) * input.PageSize;
            return(await _identityRoleAppService.GetListAsync(request));
        }