Ejemplo n.º 1
0
        public ActionResult RemoveDish(Guid DishId)
        {
            var _manager = new DishManager();

            _manager.DeleteDishByID(DishId);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult RemoveDish(Guid DishId)
        {
            if (!IsAuthorized())
            {
                return(View("Error"));
            }
            var _manager = new DishManager();
            var dish     = _manager.GetDishByIDObject(DishId);

            if (dish != null)
            {
                _manager.DeleteDishByID(DishId);
                var _ordermanager = new OrderManager();
                var orders        = _ordermanager.GetOrderByStallIDObjects(dish.Fields.StallID);
                foreach (var item in orders)
                {
                    if (item.Fields.DishID == DishId)
                    {
                        _ordermanager.DeleteOrderByID(item.Fields.ID.Value);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }