aboutsummaryrefslogtreecommitdiff
blob: a8a983af827022225ea2967aa72019eceaf6d016 (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
using System.Collections.Generic;

namespace KukaPizza.Models
{
    public enum PizzaSize
    {
        Small,
        Medium,
        Large
    }
    public class PizzaOrder
    {
        public Pizza BasePizza { get; set; }
        public List<Topping> ExtraToppings { get; set; }
        public PizzaSize Size { get; set; }

        public string ExtraToppingsToString()
        {
            string toppings = "";

            for (int i = 0; i < ExtraToppings.Count - 1; i++)
            {
                toppings += ExtraToppings[i].Name + ", ";
            }

            toppings += ExtraToppings[ExtraToppings.Count - 1].Name;

            return toppings;
        }

        public double GetPrice()
        {
            double totalPrice = BasePizza.Price;

            foreach (var t in ExtraToppings)
            {
                totalPrice += t.Price;
            }

            return totalPrice;
        }
    }
}