diff options
Diffstat (limited to 'Views/OrderPizzaStep4View.cs')
-rw-r--r-- | Views/OrderPizzaStep4View.cs | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Views/OrderPizzaStep4View.cs b/Views/OrderPizzaStep4View.cs new file mode 100644 index 0000000..b027e7e --- /dev/null +++ b/Views/OrderPizzaStep4View.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using KukaPizza.Controllers; +using KukaPizza.Models; + +namespace KukaPizza.Views +{ + public class OrderPizzaStep4View : View + { + private OrderPizzaController _controller; + private PizzaOrder order; + + public OrderPizzaStep4View(OrderPizzaController controller) + { + _controller = controller; + order = _controller.Order; + Init(_controller); + } + protected override void Draw() + { + Console.Clear(); + Console.Write( +@"================================================================================ + Step 4. Confirm order +================================================================================ + +"); + Console.WriteLine($" Base pizza: {order.BasePizza.Name}"); + Console.WriteLine($" Extra toppings: {order.ExtraToppingsToString()}"); + Console.WriteLine($" Size: {order.Size}"); + Console.WriteLine($" Price: {order.GetPrice()}"); + + Console.Write( +@" + Do you want to place this order? + 1. Yes, pay with Visa card + 2. Yes, pay with Mastercard card + 3. No, go back +"); + Console.Write($"\nChoose number [1-3]: "); + } + + protected override void Interact() + { + string choice = ""; + + do + { + Console.CursorVisible = true; + choice = Console.ReadLine(); + Console.CursorVisible = false; + + if (choice == "1") + { + _controller.MakePaymentWithVisa(); + } + else if (choice == "2") + { + _controller.MakePaymentWithMastercard(); + } + else if (choice == "3") + { + _controller.CancelOrder(); + Console.WriteLine("\nOrder canceled."); + } + + if (choice == "1" || choice == "2") + { + _controller.ConfirmOrder(); + Console.WriteLine("\nOrder successfully placed."); + } + + Console.WriteLine("Press any key to return to the main screen..."); + Console.ReadKey(); + _controller.GoBackToMainView(); + + + Draw(); + } while (choice != "3"); + } + } +}
\ No newline at end of file |