private static void PerformBuyStock(Stock stock) { int quantity; decimal price; Console.WriteLine($"Quantity of {stock.Name} bought: "); quantity = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Purchase price per item bought: "); price = Convert.ToDecimal(Console.ReadLine()); // Creating sale transaction: StockPurchaseTransaction purchase = new StockPurchaseTransaction(stock, price, quantity); purchase.Execute(); purchase.PrintSummary(); }
private static void PerformPurchaseStock(Warehouse toWarehouse) { int quantity; decimal price; Console.WriteLine("---- PURCHASE STOCK ----"); Stock stock = FindStockItem(toWarehouse); if (stock == null) { return; } quantity = ReadInteger($"Quantity of {stock.Name}: "); price = ReadDecimal("Price: "); StockPurchaseTransaction purchase = new StockPurchaseTransaction(stock, quantity, price); toWarehouse.ExecuteTransaction(purchase); purchase.PrintSummary(); }