aboutsummaryrefslogtreecommitdiff
blob: bedf38ff41c4d5ce3e243d7bfed9269d966d2f0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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<PizzaOrder> 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');
        }
    }
}