public PagingResult<UploadFileItem> GetAll(int pageIndex, int pageSize)
 {
     var response = _client.GetAll(pageIndex, pageSize, _fileDir);
     var result = CommandResult.Create(response);
     var total = 0;
     var list = new List<UploadFileItem>();
     if (result.StatusCode == StatusCodes.Success)
     {
         total = int.Parse(result.Results["total"]);
         var items = result.Results["items"];
         if (!String.IsNullOrEmpty(items))
         {
             var fileKeys = items.Split(',');
             list.AddRange(fileKeys.Select(CreateUploadFileItem));
         }
     }
     var results = new PagingResult<UploadFileItem>(list)
                       {
                           CurrentPage = pageIndex,
                           PageSize = pageSize,
                           TotalItems = total
                       };
     return results;
 }
        public Task<PagingResult<User>> QueryUsers(string username, string claimType, string claimValue, Paging paging)
        {
            var users =
                this.userManager.Users
                    .WhereIf(() => !string.IsNullOrWhiteSpace(username), u => u.Id.Contains(username))
                    .WhereIf(() => !string.IsNullOrWhiteSpace(claimType) && !string.IsNullOrWhiteSpace(claimValue), 
                                u => u.Claims.Any(c => c.ClaimType == claimType && c.ClaimValue.Contains(claimValue)))
                    .Select(u => u.ToDomainModel());
            
            var pagedUsers = users.ToPagedList(paging.Page, paging.PageSize);
            var pagingResult = new PagingResult<User>(
                new PageDetails(pagedUsers.PageNumber, pagedUsers.PageSize, pagedUsers.Count, pagedUsers.PageCount, pagedUsers.TotalItemCount),
                pagedUsers);

            return Task.FromResult(pagingResult);
        }