private static void CreateAndProcessOrder(User user) // TODO: Thinking about having the list of parts be sent as params { user.SelectedStore.CreateOrder(); user.Orders.Add(user.SelectedStore.Orders.Last()); // last because the above line just created a new order List <Crust> availableCrusts = _sql.GetCrusts().ToList(); List <Size> availableSizes = _sql.GetSizes().ToList(); List <Topping> availableToppings = _sql.GetToppings().ToList(); Order currentOrder = user.Orders.Last(); string submitInput = ""; do { PrintMessage("Available Pizzas:"); PrintAvailablePizzaTypes(); PrintMessage("Enter a type of pizza to add to your order."); string typeInput = Console.ReadLine(); PrintMessage("Enter the size for your pizza"); string sizeInput = Console.ReadLine(); switch (typeInput) { case "Meat": currentOrder.MakeMeatPizza(availableCrusts, availableSizes, availableToppings); break; case "Pineapple": currentOrder.MakePineapplePizza(availableCrusts, availableSizes, availableToppings); break; case "Gumbo": currentOrder.MakeGumboPizza(availableCrusts, availableSizes, availableToppings); break; default: break; } currentOrder.ChangeLastPizzaSize(sizeInput, availableSizes); // Reason for no if - editing a pizza to small and then back to medium //currentOrder.PrintPriceOfLastPizza(); PrintTallyWithMsg("Current Order Total", currentOrder); do { System.Console.WriteLine("What would you like to do?"); System.Console.WriteLine("a) Add another pizza to your order"); if (!currentOrder.CheckIfZeroPizzas()) { System.Console.WriteLine("b) Edit the pizzas in your order"); System.Console.WriteLine("c) Checkout"); } else { System.Console.WriteLine("d) Cancel Order"); } submitInput = Console.ReadLine(); // Edit Pizza Area if (submitInput == "b") { currentOrder.PrintPizzas(); System.Console.WriteLine("Which pizza would you like to edit? (use numbers, starting from 1)"); int.TryParse(Console.ReadLine(), out int pizzaNumInput); pizzaNumInput = pizzaNumInput - 1; var selectedPizza = currentOrder.Pizzas.ElementAtOrDefault(pizzaNumInput); PrintMessage("What do you want to do with this pizza?"); DisplayOptions(new string[] { "a) Change the type of crust", "b) Change the size", "c) Remove it" }); string editOptionInput = Console.ReadLine(); switch (editOptionInput) { case "a": // TODO: Use one common method for this two cases PrintMessage(selectedPizza.ToString() + "'s Current Crust: " + selectedPizza.Crust.ToString()); PrintMessage("What do you want to change the Crust to"); foreach (var c in availableCrusts) { System.Console.WriteLine(c); } string crustChoiceInput = Console.ReadLine(); currentOrder.ChangePizzaCrust(pizzaNumInput, crustChoiceInput, availableCrusts); PrintTallyWithMsg("Updated Order Tally", currentOrder); break; case "b": PrintMessage(selectedPizza.ToString() + "'s Current Size: " + selectedPizza.Size.ToString()); PrintMessage("What do you want to change the Size to?"); foreach (var c in availableSizes) { System.Console.WriteLine(c); } string sizeChoiceInput = Console.ReadLine(); currentOrder.ChangePizzaSize(pizzaNumInput, sizeChoiceInput, availableSizes); PrintTallyWithMsg("Updated Order Tally", currentOrder); break; case "c": currentOrder.RemovePizza(pizzaNumInput); PrintTallyWithMsg("Updated Order Tally", currentOrder); break; default: break; } } } while (submitInput == "b"); } while (submitInput == "a"); if (submitInput == "c") { // Display final tally and associated message PrintTallyWithMsg("Final Order Total", currentOrder); _sql.Update(user.SelectedStore); //System.Console.WriteLine(user); do { System.Console.WriteLine("Thank you for your order. Will that be all?"); DisplayOptions(new string[] { "a) Yes", "b) Show order history", "c) Make another order" }); submitInput = Console.ReadLine(); switch (submitInput) { case "a": PrintMessage($"Thank you for choosing {user.SelectedStore}. Come again!"); break; case "b": _sql.DisplayUserOrderHistory(user); break; case "c": CreateAndProcessOrder(user); break; default: break; } } while (submitInput == "b"); } if (submitInput == "d") { user.SelectedStore.DeleteOrder(currentOrder); PrintMessage("Thank you. Come again!"); } }