public void GetStores() { try { foreach (var item in _locationBL.GetLocations()) { Console.WriteLine(item.ToString()); } Console.WriteLine("Enter a Store Code to Shop:"); int storeCode = int.Parse(Console.ReadLine()); Location selectedLocation = _locationBL.GetSpecificLocation(storeCode); if (selectedLocation == null) { Console.WriteLine("Error - store code not valid"); } else { Console.WriteLine($"{selectedLocation.LocationName} Inventory:"); foreach (var item in _itemBL.GetItemsByLocation(storeCode)) { Console.WriteLine(item.Product.ToString()); Console.WriteLine(item.ToString()); } Order newOrder = new Order(); //create new order object bool shop = true; List <Product> cartProducts = new List <Product>(); List <int> cartQuantity = new List <int>(); double totalCost = 0.0; do { //Product selectedProduct = null; Console.WriteLine(); Console.WriteLine("Select ProductID to add product to your order"); Console.WriteLine("Type \'Cancel\' to cancel order or \'Finish\' to complete your order"); Console.WriteLine("Selection:"); string option = Console.ReadLine(); if (option == "Cancel" || option == "cancel") { shop = false; } else if (option == "Finish" || option == "finish") { //Create Order newOrder.Total = totalCost; newOrder.Location = selectedLocation; bool findCustomer = false; do { Customer orderCust = FindCustomer(); if (orderCust == null) { Console.WriteLine("No matching customer found, try searching again"); } else { newOrder.Customer = orderCust; findCustomer = true; } }while(!findCustomer); _orderBL.AddOrder(newOrder); //Add products to ProductOrder int oID = _orderBL.FindOrder(newOrder.Total).OrderID; for (int i = 0; i < cartProducts.Count; i++) { ProductOrder po = new ProductOrder(); po.Order = _orderBL.FindOrder(oID); po.Product = cartProducts[i]; po.Quantity = cartQuantity[i]; _productOrderBL.AddProductOrder(po); Console.WriteLine("Order Summary:"); Console.WriteLine("--------------"); po.ToString(); _productBL.ProductsByOrder(po.Order.OrderID); } Console.WriteLine("Order successfully placed!"); Log.Information("Order Created"); shop = false; } else if (option != "Cancel" && option != "Finish") { foreach (var item in _productBL.GetProducts()) { if (int.Parse(option) == item.ProductID) { cartProducts.Add(item); Console.WriteLine("Enter quantity:"); int quantity = int.Parse(Console.ReadLine()); cartQuantity.Add(quantity); totalCost = (totalCost) + (item.Price * quantity); } } } }while (shop); } } catch { Console.WriteLine("Something went wrong...canceling order"); } }