aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Builders')
-rw-r--r--Builders/IPizzaBuilder.cs12
-rw-r--r--Builders/PizzaBuilder.cs29
2 files changed, 41 insertions, 0 deletions
diff --git a/Builders/IPizzaBuilder.cs b/Builders/IPizzaBuilder.cs
new file mode 100644
index 0000000..dac9009
--- /dev/null
+++ b/Builders/IPizzaBuilder.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using KukaPizza.Models;
+
+namespace KukaPizza.Builders
+{
+ public interface IPizzaBuilder
+ {
+ void ChooseBase(Pizza pizza);
+ void AddExtraToppings(List<Topping> extraToppings);
+ void ChooseSize(PizzaSize size);
+ }
+} \ No newline at end of file
diff --git a/Builders/PizzaBuilder.cs b/Builders/PizzaBuilder.cs
new file mode 100644
index 0000000..e86cdaf
--- /dev/null
+++ b/Builders/PizzaBuilder.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using KukaPizza.Models;
+
+namespace KukaPizza.Builders
+{
+ public class PizzaBuilder : IPizzaBuilder
+ {
+ PizzaOrder _pizzaOrder = new PizzaOrder();
+ public void ChooseBase(Pizza pizza)
+ {
+ _pizzaOrder.BasePizza = pizza;
+ }
+
+ public void AddExtraToppings(List<Topping> extraToppings)
+ {
+ _pizzaOrder.ExtraToppings = extraToppings;
+ }
+
+ public void ChooseSize(PizzaSize size)
+ {
+ _pizzaOrder.Size = size;
+ }
+
+ public PizzaOrder GetResult()
+ {
+ return _pizzaOrder;
+ }
+ }
+} \ No newline at end of file