public bool WithdrawAmount(ICardAccount cardAccount, decimal withdrawValue) { cardAccount.CardCash = cardAccount.CardCash - withdrawValue; if (cardAccount.CardCash < 0) { return(false); } return(true); }
private static bool WithdrawSum( AtmEntities dbContext, CardAccountRepository cardAcountRepo, TransactionHistoryRepository tarnsactionHystoryRepo, ICardAccount cardAccount) { var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo); var consoleHandler = ConsoleHandler.Instance; consoleHandler.Print("Enter value to withdraw: "); var withdrawValueInput = consoleHandler.GetStringInput(); decimal withdrawValue = new decimal(); if(!decimal.TryParse(withdrawValueInput, out withdrawValue)) { return false; } return transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue); }
private static bool WithdrawSum( AtmEntities dbContext, CardAccountRepository cardAcountRepo, TransactionHistoryRepository tarnsactionHystoryRepo, ICardAccount cardAccount) { var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo); var consoleHandler = ConsoleHandler.Instance; consoleHandler.Print("Enter value to withdraw: "); var withdrawValueInput = consoleHandler.GetStringInput(); decimal withdrawValue = new decimal(); if (!decimal.TryParse(withdrawValueInput, out withdrawValue)) { return(false); } return(transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue)); }
public bool IsCashAmountSufficient(ICardAccount cardAccount, decimal withdrawValue) { return(cardAccount.CardCash >= withdrawValue); }