protected override AbstractPizza CreatePizza(PizzaTypesEn type) { var ingredientsFactory = new ChicagoIngredientsFactory(); switch (type) { case PizzaTypesEn.Cheese: return(new CheesePizza(ingredientsFactory) { Name = "Chicago Style Cheese Pizza" }); case PizzaTypesEn.Veggie: return(new VeggiePizza(ingredientsFactory) { Name = "Chicago Style Veggie Pizza" }); case PizzaTypesEn.Clam: return(new ClamPizza(ingredientsFactory) { Name = "Chicago Style Clam Pizza" }); case PizzaTypesEn.Pepperoni: return(new PepperoniPizza(ingredientsFactory) { Name = "Chicago Style Pepperoni Pizza" }); default: throw new System.NotImplementedException(); } }
protected override Pizza Create(string type) { Pizza pizza; IIngredientsFactory ingredients = new ChicagoIngredientsFactory(); if (type.Equals("Cheese")) { pizza = new CheesePizza(ingredients); pizza.Name = "Chicago Cheese"; } else if (type.Equals("Clam")) { pizza = new ClamPizza(ingredients); pizza.Name = "Chicago Clam"; } else { pizza = new VeggiePizza(ingredients); pizza.Name = "Chicago Veggie"; } pizza.Color = "red"; return(pizza); }