Ejemplo n.º 1
0
        public ActionResult SaveMenu()
        {
            string json = "";

            try
            {
                json = Request["data"];
            }
            catch (Exception e)
            {
                return(Json(new AjaxResult {
                    Success = false, Message = "含有非法字符,请重新输入!"
                }, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrWhiteSpace(json))
            {
                throw new BusinessException("传入数据不能为空");
            }

            SysMenu menu = JsonConvert.DeserializeObject <SysMenu>(json);

            if (menu.SysNo > 0)
            {
                menu.EditUserSysNo = CurrUser.UserSysNo;
                menu.EditUserName  = CurrUser.UserDisplayName;
                menu_service.UpdateSysMenu(menu);
            }
            else
            {
                menu.InUserSysNo = CurrUser.UserSysNo;
                menu.InUserName  = CurrUser.UserDisplayName;
                menu_service.InsertSysMenu(menu);
            }

            return(Json(new AjaxResult {
                Success = true, Message = "保存成功"
            }, JsonRequestBehavior.AllowGet));
        }