aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <marcin@zelent.net>2021-02-21 14:13:49 +0100
committermarcinzelent <marcin@zelent.net>2019-12-20 14:21:37 +0100
commitb1eb36d3fbc5012b07489454a7452e8488507f6a (patch)
treef6a9e6e561eabde5b06366a6aeac78df123ca917 /Models/PizzaOrder.cs
Initial commitHEADmaster
Diffstat (limited to 'Models/PizzaOrder.cs')
-rw-r--r--Models/PizzaOrder.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Models/PizzaOrder.cs b/Models/PizzaOrder.cs
new file mode 100644
index 0000000..a8a983a
--- /dev/null
+++ b/Models/PizzaOrder.cs
@@ -0,0 +1,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;
+ }
+ }
+} \ No newline at end of file