コード例 #1
0
 public ReturnResult <bool> Delete(Menu model)
 {
     using (menuDal)
     {
         return(menuDal.Delete(model));
     }
 }
コード例 #2
0
        public ActionResult Delete(int id = 0)
        {
            var menus = _menuDal.GetAll <Menu>();

            if (menus.FirstOrDefault(p => p.MenuParentId == id) != null)
            {
                return(Json(AjaxResult.Fail("请先删除子菜单")));
            }

            var m = menus.FirstOrDefault(p => p.Id == id);

            if (m != null)
            {
                var result = DeleteWXMenu(m);
                if (!string.IsNullOrEmpty(result))
                {
                    return(Json(AjaxResult.Fail(result)));
                }

                _menuDal.Delete(new Menu {
                    Id = id
                });
            }


            return(Json(AjaxResult.Success()));
        }