public async Task <Transaction> Add(Transaction transaction) { switch (transaction.TransactionTypeId) { case 1: await WithdrawFromTheAccount(transaction); break; case 2: await DepositToTheAccount(transaction); break; case 3: await TransferToAccount(transaction); break; default: break; } _context.Add(transaction); await _context.SaveChangesAsync(); Eventss.publishEvent(this, transaction); return(transaction); }
public async Task <Transaction> Update(Transaction transaction) { _context.Update(transaction); await _context.SaveChangesAsync(); Eventss.publishEvent(this, transaction); return(transaction); }