コード例 #1
0
        public ActionResult Update(int tableOrderId, int dishId, int quantity)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.UpdateDish(dishId, quantity);
            return(RedirectToAction("Show"));
        }
コード例 #2
0
        public ActionResult Update(int tableOrderId, string tableNumber, DateTime orderDate)
        {
            TableOrder foundTableOrder = TableOrder.Find(tableOrderId);

            foundTableOrder.Edit(tableNumber, orderDate);
            return(RedirectToAction("Show"));
        }
コード例 #3
0
        public ActionResult Create(int tableOrderId, int dishId, int newDishQuantity)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.AddDish(dishId, newDishQuantity);
            return(RedirectToAction("Show"));
        }
コード例 #4
0
        public ActionResult Delete(int tableOrderId)
        {
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.Delete();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
        public ActionResult Delete(int tableOrderId, int dishId)
        {
            Console.WriteLine(" Delete: {0} {1}", tableOrderId, dishId);
            TableOrder foundOrder = TableOrder.Find(tableOrderId);

            foundOrder.DeleteDish(dishId);
            return(RedirectToAction("Show"));
        }
コード例 #6
0
        public ActionResult Show(int tableOrderId)
        {
            TableOrder foundOrder             = TableOrder.Find(tableOrderId);
            Dictionary <string, object> model = new Dictionary <string, object>();

            model["order"]        = foundOrder;
            model["order_dishes"] = foundOrder.GetAllDishes();
            model["all_dishes"]   = foundOrder.GetPotentialDishes();//Dish.GetAll();
            return(View(model));
        }
コード例 #7
0
        public void Find_FindsOrderInDatabase_Order()
        {
            string     tableNumber = "4";
            DateTime   orderDate   = new DateTime(2019, 3, 12);
            TableOrder newOrder    = new TableOrder(tableNumber, orderDate);

            newOrder.Save();

            int        id        = newOrder.GetId();
            TableOrder testOrder = TableOrder.Find(id);

            Assert.AreEqual(newOrder, testOrder);
        }
コード例 #8
0
        public ActionResult Edit(int tableOrderId)
        {
            TableOrder foundTableOrder = TableOrder.Find(tableOrderId);

            return(View(foundTableOrder));
        }