コード例 #1
0
        public async Task <IActionResult> GetAsync(
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetIdentityRolesInput
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit
            };
            var res = await _IdentityRoleAppService.GetListAsync(serchInp);

            string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                           res.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Items.Count, res.TotalCount);

            if (!filter.IsNullOrEmpty())
            {
                listRes += string.Format(" for \"{0}\"", serchInp.Filter);
            }
            ViewBag.ListState = listRes;

            ViewBag.Filter     = filter;
            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:syncVt('{0}', '" + filter + "');",
                p.Value, res.TotalCount, AppTheme.Limit);
            return(PartialView(TableView, res));
        }
コード例 #2
0
 public virtual async Task <PagedResultDto <IdentityRoleDto> > GetListAsync(GetIdentityRolesInput input)
 {
     return(await RequestAsync <PagedResultDto <IdentityRoleDto> >(nameof(GetListAsync), new ClientProxyRequestTypeValue
     {
         { typeof(GetIdentityRolesInput), input }
     }));
 }
コード例 #3
0
        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));
        }
コード例 #4
0
    public virtual async Task <PagedResultDto <IdentityRoleDto> > GetListAsync(GetIdentityRolesInput input)
    {
        var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter);

        var totalCount = await RoleRepository.GetCountAsync(input.Filter);

        return(new PagedResultDto <IdentityRoleDto>(
                   totalCount,
                   ObjectMapper.Map <List <IdentityRole>, List <IdentityRoleDto> >(list)
                   ));
    }
コード例 #5
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns>Task&lt;PagedResult&lt;IdentityRoleDto&gt;&gt;.</returns>
        public virtual async Task <PagedResult <IdentityRoleDto> > GetList(GetIdentityRolesInput input)
        {
            var result = await _appService.GetListAsync(input);

            return(new PagedResult <IdentityRoleDto>(result.TotalCount, result.Items));
        }
コード例 #6
0
 public virtual Task <PagedResultDto <IdentityRoleDto> > GetListAsync(GetIdentityRolesInput input)
 {
     return(RoleAppService.GetListAsync(input));
 }
コード例 #7
0
 public Task <PagedResultDto <IdentityRoleDto> > GetRolesAsync(Guid?ouId, GetIdentityRolesInput roleInput)
 {
     return(UnitAppService.GetRolesAsync(ouId, roleInput));
 }
コード例 #8
0
        public virtual async Task <PagedResultDto <IdentityRoleDto> > GetRolesAsync(Guid?ouId, GetIdentityRolesInput roleInput)
        {
            if (!ouId.HasValue)
            {
                return(await RoleAppService.GetListAsync(roleInput));
            }
            IEnumerable <IdentityRole> list = new List <IdentityRole>();
            var ou = await UnitRepository.GetAsync(ouId.Value);

            var selfAndChildren = await UnitRepository.GetAllChildrenWithParentCodeAsync(ou.Code, ou.Id);

            selfAndChildren.Add(ou);
            foreach (var child in selfAndChildren)
            {
                list = Enumerable.Union(list, await UnitRepository.GetRolesAsync(
                                            child,
                                            roleInput.Sorting
                                            ));
            }
            return(new PagedResultDto <IdentityRoleDto>(
                       list.Count(),
                       ObjectMapper.Map <List <IdentityRole>, List <IdentityRoleDto> >(
                           list.Skip(roleInput.SkipCount).Take(roleInput.MaxResultCount)
                           .ToList()
                           )
                       ));
        }