public async Task <GetAccountByIdResponse> Handle(GetAccountByIdRequest request)
 {
     return(new GetAccountByIdResponse()
     {
         Account = AccountApiModel.FromAccount(await _context.Accounts
                                               .Include(x => x.Tenant)
                                               .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId))
     });
 }
Esempio n. 2
0
            public async Task <GetAccountsResponse> Handle(GetAccountsRequest request)
            {
                var accounts = await _context.Accounts
                               .Include(x => x.Tenant)
                               .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                               .ToListAsync();

                return(new GetAccountsResponse()
                {
                    Accounts = accounts.Select(x => AccountApiModel.FromAccount(x)).ToList()
                });
            }