コード例 #1
0
        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.");
        }
コード例 #2
0
        public async Task <AccountEntity> GetAccountEntity(int accountId)
        {
            Console.WriteLine($"AccountsRepo: Getting account with id {accountId}");

            await NotFakeDatabase.AccessDatabase();

            var account = GetAccount(accountId);

            return(account);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }