示例#1
0
        public ActionResult Add(Pub_Function model)
        {
            model.ParentCode   = Request["ids"];
            model.FunctionCode = functionBLL.GetCode(model.ParentCode);
            model.StopFlag     = false;
            model.editdate     = DateTime.Now;
            model.editor       = NBCZUser.UserCode + "-" + NBCZUser.UserName;
            if (!ModelState.IsValid)
            {
                rep.errorNo   = "-1";
                rep.errorInfo = "数据未通过验证!";
                return(Json(rep));
            }

            if (string.IsNullOrEmpty(model.ParentCode))
            {
                rep.errorNo   = "-1";
                rep.errorInfo = "父节点不能为空!";
                return(Json(rep));
            }

            var r = functionBLL.Insert(model);

            if (!string.IsNullOrEmpty(r))
            {
                rep.results.data = model.ParentCode;
                rep.errorInfo    = "添加成功";
            }
            else
            {
                rep.errorNo   = "-1";
                rep.errorInfo = "添加失败";
            }
            return(Json(rep));
        }
示例#2
0
        public DataRes <bool> Add([FromBody] Pub_Function model)
        {
            DataRes <bool> res = new DataRes <bool>()
            {
                code = ResCode.Success, data = true
            };

            model.FunctionCode = bll.GetCode(model.ParentCode);
            model.editdate     = DateTime.Now;
            var user = LQExtensionFactory.GetLQExtensionUser(User);

            model.editor   = $"{user.UserCode}-{user.UserName}";
            model.StopFlag = false;
            var r = bll.Insert(model);

            return(res);
        }