public async Task AddTransaction(TransactionEntity transaction) { await NotFakeDatabase.AccessDatabase(); Console.WriteLine($"TransactionsRepo: Adding transaction with id {transaction.Id} tot the transaction history."); NotFakeDatabase.TransactionsHistory.Add(transaction); Console.WriteLine("Transaction processed."); }
public async Task <AccountEntity> GetAccountEntity(int accountId) { Console.WriteLine($"AccountsRepo: Getting account with id {accountId}"); await NotFakeDatabase.AccessDatabase(); var account = GetAccount(accountId); return(account); }
public async Task UpdateAccount(AccountEntity accountEntity) { Console.WriteLine($"AccountsRepo: Updating account with id {accountEntity.Id}"); await NotFakeDatabase.AccessDatabase(); var account = GetAccount(accountEntity.Id); account.Balance = accountEntity.Balance; }
public async Task <IEnumerable <AccountEntity> > GetAccountEntities() { Console.WriteLine("AccountsRepo: Getting all accounts."); await NotFakeDatabase.AccessDatabase(); var accounts = NotFakeDatabase.Accounts.Values; if (!accounts.Any()) { throw new Exception("AccountsRepo: The database currently contains no accounts."); } return(accounts); }