public async Task Handle(RoundUpAdded notification, CancellationToken cancellationToken) { var savingsTransaction = _savingsService.CreateSavingsTransactionWhen(notification); await _savingsTransactionRepository.AddAsync(savingsTransaction); await _savingsTransactionRepository.SaveChangesAsync(); }
public async Task Handle(BankTransferAdded notification, CancellationToken cancellationToken) { var savingsTransaction = await _savingsService.CreateSavingsTransactionWhen(notification); if (savingsTransaction != null) { await _savingsTransactionRepository.AddAsync(savingsTransaction); await _savingsTransactionRepository.SaveChangesAsync(); } else { var expense = await _expenseService.CreateExpenseWhen(notification); if (expense != null) { await _expenseRepository.AddAsync(expense); await _expenseRepository.SaveChangesAsync(); } } }
public async Task Handle(CollectionAdded notification, CancellationToken cancellationToken) { var savingsTransaction = await _savingsService.CreateSavingsTransactionWhen(notification); if (savingsTransaction != null) { await _savingsTransactionRepository.AddAsync(savingsTransaction); await _savingsTransactionRepository.SaveChangesAsync(); } else { var income = await _incomeService.CreateIncomeWhen(notification); if (income != null) { await _incomeRepository.AddAsync(income); await _incomeRepository.SaveChangesAsync(); } } }