private static void SubtractBalance(double amount,Account account) { // Check the balance of the account, throw exception if balance cant cover credit if (amount > account.AccountBalance) throw new InsufficientFunds(); account.AccountBalance -= amount; }
private static void Transfer(double amount, Account account) { AddBalance(amount,account); AddTransaction(amount, TransactionType.TransferIn,account); }
private static void AddTransaction(double amount, TransactionType type,Account account) { account.Transactions.Add(new Transaction(type, amount, account.AccountBalance)); }
private static void AddBalance(double amount, Account account) { account.AccountBalance += amount; }
public static void Transfer(double amount, ref Account accountTo,Account account) { SubtractBalance(amount,account); AddTransaction(amount, TransactionType.TransferOut,account); Transfer(amount,account); }
public static void Debit(Double amount, Account account) { SubtractBalance(amount,account); AddTransaction(amount, TransactionType.Debit,account); }
public static void Credit(Double amount, Account account) { // Check the balance of the account, throw exception if balance cant cover credit AddBalance(amount,account); AddTransaction(amount, TransactionType.Credit,account); }