private static void RecordWithdrawOperation(AtmDbContext context, CardAccount account, decimal amount) { context.TransactionsHistory.Add(new TransactionHistory { CardNumber = account.CardNumber, TransactionDate = DateTime.Now, Amount = amount }); context.SaveChanges(); }
private static void CheckForEnoughFunds(CardAccount account, decimal amount) { if (account == null) { throw new ArgumentNullException("account", "There is no such account in the DB"); } if (account.CardCash < amount) { throw new ArgumentException("Not enough funds available in the selected account.", "amount"); } }
private static void ValidateAccount(CardAccount account, string pin) { if (account == null) { throw new ArgumentNullException("account", "There is no such account in the DB"); } if (account.CardPIN != pin) { throw new ArgumentException("Invalid PIN for the selected account provided.", "pin"); } }