public IActionResult Add2()
        {
            Pizza pizza = new Pizza();

            pizza.CrustId     = 1;
            pizza.PizzaSizeId = 3;
            pizza.PizzaPrice  = (decimal)11.49;
            pizza.PizzaSize   = PizzaSizes.Where(ps => ps.PizzaSizeId == pizza.PizzaSizeId).First();
            pizza.Crust       = Crusts.Where(c => c.CrustId == pizza.CrustId).First();

            PizzaTopping pizzaTopping = new PizzaTopping();

            pizzaTopping.ToppingId    = 19;
            pizzaTopping.ToppingCount = 1;
            pizzaTopping.Topping      = Toppings.Where(t => t.ToppingId == pizzaTopping.ToppingId).First();
            pizza.PizzaToppings.Add(pizzaTopping);

            pizzaTopping              = new PizzaTopping();
            pizzaTopping.ToppingId    = 8;
            pizzaTopping.ToppingCount = 1;
            pizzaTopping.Topping      = Toppings.Where(t => t.ToppingId == pizzaTopping.ToppingId).First();
            pizza.PizzaToppings.Add(pizzaTopping);

            _order.Pizzas.Add(pizza);
            _order.Cost += pizza.PizzaPrice;
            return(View("AddPizza"));
        }
Пример #2
0
 public Store(List <Topping> toppings, List <Size> sizes, List <Crust> crusts, List <Pizza> presets)
 {
     Toppings.AddRange(toppings);
     Sizes.AddRange(sizes);
     Crusts.AddRange(crusts);
     PizzaPresets.AddRange(presets);
 }
 public IActionResult SetCrust(int id)
 {
     _crustId     = id;
     _crust       = Crusts.Where(c => c.CrustId == id).First();
     _pizzaPrice += _crust.CrustPrice;
     return(View("SelectTopping"));
 }
Пример #4
0
        public static double GetCrustCost(Crusts crust)
        {
            var standardCrustCost = 0.0;
            var specialCrustCost  = 1.0;

            return(crust == Crusts.Stuffed ? specialCrustCost : standardCrustCost);
        }
Пример #5
0
        public CrustDecorator(Pizza pizza, Crusts crust)
            : base(pizza)
        {
            Crust = crust;

            cost        = PricingClient.GetCrustCost(Crust);
            description = $"{Crust} crust";
        }
Пример #6
0
        public PizzaMenuApiModel()
        {
            Sizes.Add(new Size {
                Name = "Small", Price = 8d
            });
            Sizes.Add(new Size {
                Name = "Medium", Price = 10d
            });
            Sizes.Add(new Size {
                Name = "Large", Price = 12d
            });
            Sizes.Add(new Size {
                Name = "Extra-Large", Price = 15d
            });

            Crusts.Add(new Crust {
                Name = "Cracker", Price = 0d
            });
            Crusts.Add(new Crust {
                Name = "New York", Price = .50d
            });
            Crusts.Add(new Crust {
                Name = "Chicago", Price = .75d
            });

            Ingredients.Add(new Ingredient {
                Name = "Tomato Sauce", Price = 0d
            });
            Ingredients.Add(new Ingredient {
                Name = "Cheese", Price = 0d
            });
            Ingredients.Add(new Ingredient {
                Name = "Sausage", Price = .5d
            });
            Ingredients.Add(new Ingredient {
                Name = "Pepperoni", Price = .5d
            });
            Ingredients.Add(new Ingredient {
                Name = "Anchovies", Price = 1.25d
            });
            Ingredients.Add(new Ingredient {
                Name = "Pineapple", Price = .75d
            });
            Ingredients.Add(new Ingredient {
                Name = "Peppers", Price = .25d
            });
        }
Пример #7
0
 protected override void AddCrust()
 {
     Crust = new Crusts().Name;
 }
Пример #8
0
 public Pizza(Crusts c, Sizes s, List <Item> st)
 {
     SelectedCrust    = c;
     SelectedSize     = s;
     SelectedToppings = st;
 }
Пример #9
0
 public Pizza()
 {
     SelectedCrust    = 0;
     SelectedSize     = 0;
     SelectedToppings = new List <Item>();
 }
Пример #10
0
 public IPizzaBuilderToppings WithCrust(Crusts crust)
 {
     pizza = new CrustDecorator(pizza, crust);
     return(this);
 }
Пример #11
0
 public IPizzaBuilderSauce WithCrust(Crusts selectedCrust)
 {
     pizza.Crust = selectedCrust;
     return(this);
 }