From b1eb36d3fbc5012b07489454a7452e8488507f6a Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Sun, 21 Feb 2021 14:13:49 +0100 Subject: Initial commit --- Views/CheckOrdersView.cs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Views/CheckOrdersView.cs (limited to 'Views/CheckOrdersView.cs') diff --git a/Views/CheckOrdersView.cs b/Views/CheckOrdersView.cs new file mode 100644 index 0000000..bedf38f --- /dev/null +++ b/Views/CheckOrdersView.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using KukaPizza.Controllers; +using KukaPizza.Models; + +namespace KukaPizza.Views +{ + public class CheckOrdersView : View + { + private CheckOrdersController _controller; + private List orders; + public CheckOrdersView(CheckOrdersController controller) + { + _controller = controller; + orders = controller.Orders; + Init(_controller); + } + + protected override void Draw() + { + Console.Clear(); + Console.Write( +@"================================================================================ + Your orders +================================================================================ +"); + foreach (var o in orders) + { + Console.WriteLine($" Base pizza: {o.BasePizza.Name}"); + Console.WriteLine($" Extra toppings: {o.ExtraToppingsToString()}"); + Console.WriteLine($" Size: {o.Size}"); + Console.Write("--------------------------------------------------------------------------------"); + } + + Console.WriteLine("\n 0. Go back"); + } + + protected override void Interact() + { + int choice = 0; + + do + { + choice = Console.ReadKey(true).KeyChar; + + Draw(); + } while (choice != '0'); + } + } +} \ No newline at end of file -- cgit v1.2.3