Esempio n. 1
0
        public decimal ViewPizzaPrice(PizzaModel pizza)
        {
            decimal price = 0.00m;

            price += (pizza.Size.Price + pizza.Crust.Price);
            foreach (var pt in pizza.PizzaToppings)
            {
                price += pt.Topping.Price;
            }

            return(price);
        }
        public void AddPizza(PizzaViewModel pizzaViewModel, string CustomerName)
        {
            var pizza = new PizzaModel();

            pizza.Name  = pizzaViewModel.PizzaName;
            pizza.Crust = pizzaViewModel.Crusts.Find(x => x.Name == pizzaViewModel.Crust);
            pizza.Size  = pizzaViewModel.Sizes.Find(x => x.Name == pizzaViewModel.Size);

            pizza.Toppings = new List <ToppingModel>();
            foreach (var topping in pizzaViewModel.SelectedToppings)
            {
                pizza.Toppings.Add(pizzaViewModel.Toppings.Find(t => t.Name == topping));
            }

            repo.AddPizza(pizza, CustomerName);
        }
Esempio n. 3
0
 public void AddPizza(PizzaModel pizza)
 {
     Pizzas.Add(pizza);
 }