public async Task <IEnumerable <View.Account> > Get(AccountGetBinding b) { using (var context = GetMainContext()) { return(await context.Accounts.Include(x => x.Bank) .Include(x => x.Currency) .WhereIf(b.IsActive, x => x.Active == b.IsActive) .Select(x => new View.Account(x) { Balance = x.Transactions.Sum(x => x.Amount) }) .ToListAsync()); } }
public async Task <IActionResult> Get([FromQuery] AccountGetBinding binding) => Ok(await _accountHandler.Get(binding));