Beispiel #1
0
        /// <summary>
        /// 编辑功能
        /// </summary>
        /// <param name="input"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public ActionResult EditFunc(Dictionary <string, string> input, sys_member profile)
        {
            sys_func f = JsonConvert.DeserializeObject <sys_func>(input["inputData"]);

            if (input["type"] == "save")
            {
                _db.Updateable(f).ExecuteCommand();
            }
            else if (input["type"] == "del")
            {
                if (!_db.Queryable <sys_func>().Where(_f => _f.pid == f.ID).Any())
                {
                    _db.Deleteable <sys_func>().Where(d => d.ID == f.ID).ExecuteCommand();
                }
                else
                {
                    return(new ActionResult(false, null, null, "请先删除子节点"));
                }
            }
            else
            {
                if (f.pid != null && f.pid == 0)
                {
                    f.pid = null;
                }
                if (input.ContainsKey("child") && input["child"] == "child")
                {
                    f.pid = f.ID;
                }
                _db.Insertable(f).ExecuteCommand();
            }
            return(new ActionResult(true));
        }
Beispiel #2
0
        public bool SaveChange(SysFunc entity)
        {
            var func = new sys_func();

            func.Mapp(entity);
            return(_baseQueryRepository.Context.Updateable(func).Where(r => r.ID == entity.ID).ExecuteCommand() > 0);
        }
Beispiel #3
0
        public (bool success, string msg) Add(SysFunc sysFunc)
        {
            var func = new sys_func();

            func.Mapp(sysFunc);
            var success = _baseQueryRepository.Context.Insertable(func).ExecuteCommand() > 0;

            return(success, success ? null : "添加失败!");
        }
Beispiel #4
0
        public void SaveData(sys_func dto)
        {
            if (dto.id == 0)
            {
                dto.id          = NewLongId();
                dto.create_time = DateTime.Now;
                dto.creator     = "admin";

                Sqldb.Insertable(dto).ExecuteCommand();
            }
            else
            {
                Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator }).ExecuteCommand();
            }
        }
        public JsonResult SaveData(sys_func dto)
        {
            _funcApp.SaveData(dto);

            return(JsonJui());
        }