コード例 #1
0
ファイル: AtmClient.cs プロジェクト: tormibg/SoftUni-1
        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();
        }
コード例 #2
0
ファイル: AtmClient.cs プロジェクト: tormibg/SoftUni-1
        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");
            }
        }
コード例 #3
0
ファイル: AtmClient.cs プロジェクト: tormibg/SoftUni-1
        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");
            }
        }