Ejemplo n.º 1
0
 public async Task <List <AdminAccountListItem> > Handle(AccountListQuery request, CancellationToken cancellationToken)
 {
     return(await userManager.Users
            .Select(u => new AdminAccountListItem()
     {
         Email = u.Email,
         EmailConfirmed = u.EmailConfirmed,
         Id = u.Id,
         UserName = u.UserName
     }).ToListAsync());
 }
        public Task <List <AdminAccountListItem> > Handle(AccountListQuery request, CancellationToken cancellationToken)
        {
            var users = userManager.Users.ToList();

            return(Task.FromResult(users.Select(u => new AdminAccountListItem()
            {
                Email = u.Email,
                EmailConfirmed = u.EmailConfirmed,
                Id = u.Id,
                UserName = u.UserName
            }).ToList()));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> ListAccounts(
            [FromServices] ApiProjectionsContext context,
            CancellationToken cancellationToken = default)
        {
            var filtering  = Request.ExtractFilteringRequest <AccountListFilter>();
            var sorting    = Request.ExtractSortingRequest();
            var pagination = Request.ExtractPaginationRequest();

            var pagedAccounts = new AccountListQuery(context)
                                .Fetch(filtering, sorting, pagination);

            Response.AddPagedQueryResultHeaders(pagedAccounts);

            return(Ok(
                       new AccountListResponse
            {
                Accounts = await pagedAccounts
                           .Items
                           .Select(x => new AccountListItemResponse(x))
                           .ToListAsync(cancellationToken)
            }));
        }