public ActionResult Edit(string id)
        {
            var dao = new FoodHandle();

            lsF = new FoodHandle().GetListFood();
            var food = dao.GetFood(id, lsF);

            SetViewBag(Int32.Parse(food.idCategory));
            return(View(food));
        }
        public ActionResult Delete(int id)
        {
            bool result = new FoodHandle().DeleteFood(id.ToString());

            if (result)
            {
                SetAlert("Xóa món thành công", "success");
                return(Redirect("/Food/DSFood"));;
            }
            else
            {
                ModelState.AddModelError("", "Xóa món thất bại");
            }
            return(Redirect("/Food/DSFood"));;
        }
 public ActionResult Edit(Food model)
 {
     if (ModelState.IsValid)
     {
         SetViewBag(Int32.Parse(model.idCategory));
         var kq = new FoodHandle().UpdateFood(model, model.id);
         if (kq)
         {
             SetAlert("Sửa món thành công", "success");
             return(Redirect("/Food/DSFood"));
         }
     }
     SetViewBag();
     return(View(model));
 }
 public ActionResult Food(Food model)
 {
     lsF = new FoodHandle().GetListFood();
     Server.HtmlEncode(model.detail);
     if (ModelState.IsValid)
     {
         string id = (Int32.Parse(lsF[lsF.Count - 1].id) + 1).ToString();
         SetViewBag(Int32.Parse(model.idCategory));
         model.id = id;
         var kq = new FoodHandle().AddFood(model, id);
         if (kq)
         {
             SetAlert("Thêm món thành công", "success");
             return(Redirect("/Food/DSFood"));
         }
     }
     SetViewBag();
     return(View(model));
 }