public static IEnumerable <SelectListItem> PizzaSizesToSelectListItems() { return(PizzaSizes.Select(x => new SelectListItem( $"{x.Pizza.Name} - {x.Size.Name} ({x.Price.ToString("C", new CultureInfo("mk-MK"))})", x.Id.ToString())).ToList()); }
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")); }
public IActionResult SelectCrust(int id) { _pizzaSizeId = id; _pizzaSize = PizzaSizes.Where(ps => ps.PizzaSizeId == id).First(); _pizzaPrice += _pizzaSize.PizzaSizePrice; return(View()); }
public string Test { get { return test; } set { test = value; } } public Pizza(PizzaTypes pizzaType, SauceTypes sauceType, CrustTypes crustType, PizzaToppings[] pizzaToppings, PizzaSizes pizzaSize) : base(pizzaType.ToString()) { this.pizzaType = pizzaType;
public static IPizza OrderPizza(PizzaSizes size) { switch (size) { case PizzaSizes.Large: return(new LargePizza()); case PizzaSizes.ExtraLarge: return(new ExtraLargePizza()); default: return(null); } }