Ejemplo n.º 1
0
        public async Task OnGetAsync(ClientsSortType sortOrder, int?pageNumber, int?pageSize)
        {
            TenantId         = _sessionTenantAccessor.TenantId;
            PageSize         = _pagingHelper.ValidatePageSize(pageSize);
            PageSizeOptions  = _pagingHelper.GetPagingSizeOptions();
            SelectedPageSize = PageSize;

            switch (sortOrder)
            {
            case ClientsSortType.EnabledAsc:
                PagedEntities =
                    await _adminServices.PageClientsAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        ClientsSortType.EnabledAsc);

                EnabledSortType = ClientsSortType.EnabledDesc;
                break;

            case ClientsSortType.EnabledDesc:
                PagedEntities =
                    await _adminServices.PageClientsAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        ClientsSortType.EnabledDesc);

                EnabledSortType = ClientsSortType.EnabledAsc;
                break;

            case ClientsSortType.NameDesc:
                PagedEntities =
                    await _adminServices.PageClientsAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        ClientsSortType.NameDesc);

                NameSortType    = ClientsSortType.NameAsc;
                EnabledSortType = ClientsSortType.EnabledDesc;
                break;

            case ClientsSortType.NameAsc:
            default:
                PagedEntities =
                    await _adminServices.PageClientsAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        ClientsSortType.NameAsc);

                NameSortType    = ClientsSortType.NameDesc;
                EnabledSortType = ClientsSortType.EnabledDesc;

                break;
            }

            CurrentSortType = sortOrder;
        }
        public async Task OnGetAsync(CertificatesSortType sortOrder, int?pageNumber, int?pageSize)
        {
            TenantId         = _sessionTenantAccessor.TenantId;
            PageSize         = _pagingHelper.ValidatePageSize(pageSize);
            PageSizeOptions  = _pagingHelper.GetPagingSizeOptions();
            SelectedPageSize = PageSize;

            switch (sortOrder)
            {
            case CertificatesSortType.SigningAlgorithmAsc:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.ExpirationAsc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmDesc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeDesc;
                ExpirationSortType       = CertificatesSortType.ExpirationDesc;
                break;

            case CertificatesSortType.SigningAlgorithmDesc:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.ExpirationDesc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmAsc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeDesc;
                ExpirationSortType       = CertificatesSortType.ExpirationDesc;
                break;

            case CertificatesSortType.ExpirationAsc:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.ExpirationAsc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmDesc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeDesc;
                ExpirationSortType       = CertificatesSortType.ExpirationDesc;
                break;

            case CertificatesSortType.ExpirationDesc:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.ExpirationDesc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmDesc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeDesc;
                ExpirationSortType       = CertificatesSortType.ExpirationAsc;
                break;

            case CertificatesSortType.NotBeforeAsc:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.NotBeforeAsc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmDesc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeDesc;
                ExpirationSortType       = CertificatesSortType.ExpirationDesc;
                break;

            case CertificatesSortType.NotBeforeDesc:
            default:
                PagedEntities =
                    await _adminServices.PageCertificatesAsync(
                        TenantId,
                        (int)(pageNumber ?? 1),
                        PageSize,
                        CertificatesSortType.NotBeforeDesc);

                SigningAlgorithmSortType = CertificatesSortType.SigningAlgorithmDesc;
                NotBeforeSortType        = CertificatesSortType.NotBeforeAsc;
                ExpirationSortType       = CertificatesSortType.ExpirationDesc;

                break;
            }

            CurrentSortType = sortOrder;
        }