コード例 #1
0
 public IActionResult Post([FromBody] PizzaPie pie)
 {
     try
     {
         _pies.Add(new PizzaPie(pie.Name));
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        // 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));
        }
コード例 #7
0
 //Add objects to respective table in Database
 public void AddPizzaToDB(PizzaPie pizza)
 {
     _db.Add(Mapper.Map(pizza));
 }