public IActionResult Post([FromBody] PizzaPie pie) { try { _pies.Add(new PizzaPie(pie.Name)); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void PricePizzaTest() { var testPizza = new PizzaPie(); testPizza.MakePizza(true, new HashSet <string> { "pineapple" }, "m"); testPizza.PricePizza("m", testPizza.Toppings, 10); Assert.Equal((decimal)8.50 * 10, testPizza.Price); }
public void MakePizzaTest() { var testPizza = new PizzaPie(); testPizza.MakePizza(true, new HashSet <string> { "pineapple" }, "m"); Assert.Equal("m", testPizza.Size); Assert.Contains("pineapple", testPizza.Toppings); Assert.True(testPizza.Sauce); }
public void DecreaseInventoryTestOneItem() { var testLocation = new Location(1); PizzaPie testPizza = new PizzaPie(); testPizza.MakePizza(true, new HashSet <string> { "pineapple" }, "m"); var testOrder = new Order(10, testPizza.Toppings, new User("joseph", "isble", 1), testLocation.StoreNumber, testPizza); testLocation.DecreaseInventory(testOrder); Assert.Equal(990, testLocation.Pineapple); }
public void SetUserOrderHistoryTest() { var testLocation = new Location(1); User testUser = new User("joseph", "isble", 1); PizzaPie testPizza = new PizzaPie(); testPizza.MakePizza(true, new HashSet <string> { "pineapple" }, "m"); var testOrder = new Order(10, testPizza.Toppings, testUser, testLocation.StoreNumber, testPizza); testUser.SetOrderHistory(testOrder); Assert.Contains(testOrder, testUser.OrderHistory); }
// GET: Order/Details/5 public ActionResult OrderDetails(int id) { var libPizza = Repo.GetOrderPizzaByOrderId(id); var webPizza = new PizzaPie { OrderId = libPizza.OrderID, Ham = libPizza.ToppingsDict["ham"], Sausage = libPizza.ToppingsDict["sausage"], Chicken = libPizza.ToppingsDict["chicken"], Pepperoni = libPizza.ToppingsDict["pepperoni"], Bbqchicken = libPizza.ToppingsDict["bbqchicken"], Onion = libPizza.ToppingsDict["onion"], Pepper = libPizza.ToppingsDict["pepper"], Pineapple = libPizza.ToppingsDict["pineapple"] }; return(View(webPizza)); }
//Add objects to respective table in Database public void AddPizzaToDB(PizzaPie pizza) { _db.Add(Mapper.Map(pizza)); }