コード例 #1
0
        private static void PlaceOrder(Library.Customer cust, StoreLocation store, Order order, List <Library.Product> products)
        {
            int prodChoice, qtyChoice = -1;

            try
            {
                Console.WriteLine($"{store.StoreName} has in stock: \n");
                store.DisplayInventoryCatalog();

                //ask if they would like to purchase an item
                Console.WriteLine("Please select an item to purchase");
                prodChoice = int.Parse(Console.ReadLine());
                Console.WriteLine("Please enter a quantity you would like purchase");
                qtyChoice = int.Parse(Console.ReadLine());

                order.AddToCart(products[prodChoice], qtyChoice);
            }
            catch (FormatException)
            {
                Console.WriteLine("You have selected an invalid option. Please allow an associate to assist you with your transaction.");
            }
        }