// Enables user to purchase a product public BuyTransaction BuyProduct(User user, Product product, int count) { BuyTransaction buyTransaction = new BuyTransaction(user, product.productPriceTag, product); buyTransaction.executeBuyMethod(user, product); writeTransactionsToLog.WriteTransactionFileToLog(buyTransaction); return buyTransaction; }
public decimal executeBuyMethod(User _user, Product _product) { if (_user.Balance < _product.productPriceTag) { throw new InsufficientCreditsException(_user, _product); } else { return _user.Balance -= amountTransaction; } }
public BuyTransaction(User _user, decimal _price, Product producttobuy) : base(_user, _price) { productItem = producttobuy; userTransaction = _user; }
public void DisplayInsufficientCash(User user, Product product) // not implemented { throw new NotImplementedException(); }