Beispiel #1
0
        /// <summary>
        /// 编辑页面初始化
        /// </summary>
        /// <returns></returns>
        public ActionResult EditScriptType(long?ScriptTypeId)
        {
            var model = new ScriptTypeInput();

            if (ScriptTypeId != null)
            {
                model = _scriptTypeService.SingScriptType(ScriptTypeId.Value);
            }
            return(View("Easyman.FwWeb.Views.Script.EditScriptType", model));
        }
Beispiel #2
0
        /// <summary>
        /// 新增/修改脚本类型
        /// </summary>
        /// <param name="input"></param>
        public void editScriptType(ScriptTypeInput input)
        {
            if (_scriptType.GetAll().Any(x => x.Name == input.Name && x.Id != input.Id))
            {
                throw new System.Exception("已有类型:" + input.Name);
            }

            // var model = input.MapTo<ScriptType>();
            var model = _scriptType.GetAll().FirstOrDefault(x => x.Id == input.Id) ?? new ScriptType();

            model = Fun.ClassToCopy(input, model, (new string[] { "Id" }).ToList());
            var res = _scriptType.InsertOrUpdate(model);

            if (res == null)
            {
                throw new System.Exception("保存失败!");
            }
        }