Esempio n. 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));
        }
Esempio n. 2
0
        internal void DeleteTitle(int id)
        {
            var noteTitleList = db.Queryable <NoteTitle>().Where(nt => nt.id == id).ToList();

            if (noteTitleList.Count > 0)
            {
                var noteTitle = noteTitleList[0];
                db.Deleteable(noteTitle).ExecuteCommand();
            }
        }