internal static PizzaUI Map(PizzaClass Pizza) { if (Pizza == null) { return(null); } return(new PizzaUI { Size = Pizza.Size, Ingrediants = Pizza.Ingrediants, PizzaID = Pizza.PizzaID, }); }
internal static PizzaClass Map(PizzaUI Pizza) { if (Pizza == null) { return(null); } PizzaClass zaa = new PizzaClass(Pizza.Size, Pizza.Ingrediants); if (Pizza.PizzaID != 0) { zaa.PizzaID = Pizza.PizzaID; } return(zaa); }
public static PizzaClass Map(Pizza pizza) { HashSet <string> ingrediants = new HashSet <string>(); foreach (var IoP in pizza.IngrediantsOnPizza) { ingrediants.Add(IoP.Ingrediant.IngrediantName); } PizzaClass pizzaClass = new PizzaClass((PizzaClass.PizzaSize)pizza.Size, ingrediants) { PizzaID = pizza.PizzaId }; return(pizzaClass); }
public static Pizza Map(PizzaClass pizzaClass, Dictionary <int, string> IngrediantDictionary) { Pizza pizza = new Pizza { Size = (int)pizzaClass.Size, Cost = (decimal)pizzaClass.Price, PizzaId = pizzaClass.PizzaID }; foreach (var ingrediant in pizzaClass.Ingrediants) { pizza.IngrediantsOnPizza.Add(new IngrediantsOnPizza { IngrediantId = IngrediantDictionary.FirstOrDefault(i => i.Value == ingrediant).Key, PizzaId = pizzaClass.PizzaID }); } return(pizza); }
public ActionResult MakePizza(PizzaOrder pizzaOrder) { try { order = TempData.Peek <OrderClass>("order"); pizza = new PizzaClass( order.location.sizes, order.location.crustTypes, order.location.toppings, pizzaOrder.size, pizzaOrder.crust, pizzaOrder.toppings); if (order.pizzas.Count < 12 && order.total + pizza.price <= 500.00m && order.location.CheckInventory(pizza)) { order.AddPizza(pizza); order.location.DecrementInventory(pizza); TempData.Put("order", order); return(RedirectToAction(nameof(PlaceOrder))); } else if (order.pizzas.Count == 12) { return(RedirectToAction(nameof(OrderIsFull))); } else if (order.total + pizza.price > 500.00m) { return(RedirectToAction(nameof(MaximumPrice))); } else { return(RedirectToAction(nameof(InventoryUnavailable))); } } catch (ArgumentException ex) { ModelState.AddModelError("Id", ex.Message); return(View()); } catch { return(View()); } }
public void NewPizza( ) { if (currentPizzaObject != null) //not first run { //store old pizza TotalPizzaScores.Add(theOrder.ScorePizza()); PizzaList.Add(currentPizza); PizzaObjects.Add(currentPizzaObject); currentPizzaObject.transform.position = new Vector3(0, 0, 20f); currentPizzaObject.SetActive(false); } else //first run { } //_BW TODO addcomponenet/getcomponent all expensive at runtime - especially in UPDATE currentPizzaObject = (GameObject)Instantiate(dough, DoughSpawnPoint.position, Quaternion.identity); // currentPizzaObject.transform.localScale = new Vector3(2.5f, 1f, 2.5f); doughMeshScript = currentPizzaObject.GetComponentInChildren <MeshFix>(); theOrder = currentPizzaObject.gameObject.AddComponent <PizzaOrders>(); theOrder.CreateOrder(); if (theOrder.PizzaOrderSize == Constants.PizzaSizes.small) { currentPizzaObject.transform.localScale = Constants.SMALL_PIZZA_SCALE; } else if (theOrder.PizzaOrderSize == Constants.PizzaSizes.medium) { currentPizzaObject.transform.localScale = Constants.MEDIUM_PIZZA_SCALE; } else if (theOrder.PizzaOrderSize == Constants.PizzaSizes.large) { currentPizzaObject.transform.localScale = Constants.LARGE_PIZZA_SCALE; } //_ME cleaned up this a bit // //currentPizzaObject.gameObject.GetComponent<PizzaOrders>().CreateOrder(); //currentPizzaObject.gameObject.AddComponent<PizzaClass>(); //currentPizza = currentPizzaObject.GetComponent<PizzaClass>(); currentPizza = currentPizzaObject.gameObject.AddComponent <PizzaClass>(); theOrder.DeliverPizza(currentPizza); }
public void BuildList(Dictionary <int, string> toppings, Dictionary <int, int> inventory, PizzaClass pizza) { UnavailableItems = new List <string>(); foreach (var topping in toppings) { if (pizza.toppingSelection[topping.Key] && inventory[topping.Key] == 0) { UnavailableItems.Add(topping.Value); } } }
public void DeliverPizza(PizzaClass pizza) { CustomersPizza = pizza; }