コード例 #1
0
        public BaseResponse <BaseTree> EditBaseTree(BaseTreeAttr condtion)
        {
            BaseTree t;
            var      thisUser = UserManager.getUserById(User.Identity.Name);
            string   msg      = "{0}基本树项目,[{1}]";

            if (string.IsNullOrEmpty(condtion.id))
            {
                //新增
                t = BaseTree.CreateBaseTree(condtion);

                //日志
                msg = string.Format(msg, "新增", condtion.text);
                UserLog.create(msg, "基本树维护", thisUser, t);

                return(BaseResponse.getResult(t, "新增成功"));
            }
            else
            {
                //编辑
                var info = BaseTree.GetBaseTreeById(condtion.id);
                t = info.EditBaseTree(condtion);

                //日志
                msg = string.Format(msg, "编辑", condtion.text);
                UserLog.create(msg, "基本树维护", thisUser, t);

                return(BaseResponse.getResult(info, "保存成功"));
            }
        }