예제 #1
0
 public JsonResult DelWiki(string ids)
 {
     Common.Json    json   = new Common.Json();
     DAO.BLL.B_Wiki b_wiki = new DAO.BLL.B_Wiki();
     foreach (var id in ids.Split(new char[] { ',' }))
     {
         b_wiki.Delete(Convert.ToInt32(id));
     }
     json.msg = "成功删除" + ids.Split(new char[] { ',' }).Length + "条记录!";
     return(Json(json));
 }
예제 #2
0
        public JsonResult AddWiki(FormCollection form)
        {
            Common.Json    json      = new Common.Json();
            DAO.BLL.B_Wiki b_wiki    = new DAO.BLL.B_Wiki();
            B_Manager      b_manager = new B_Manager();

            Domain.Wiki m_wiki = new Domain.Wiki();
            m_wiki.title     = form["txt_title"];
            m_wiki.tags      = form["txt_tags"];
            m_wiki.synopsis  = form["txt_synopsis"];
            m_wiki.sort_id   = Convert.ToInt32(form["txt_sort_id"]);
            m_wiki.content   = form["txtContent"];
            m_wiki.manager   = b_manager.Get(Convert.ToInt32(base.User.Identity.Name));
            m_wiki.add_time  = DateTime.Now;
            m_wiki.parent_id = Convert.ToInt32(form["txt_parent_id"]);
            if (m_wiki.parent_id != 0)
            {
                var m = b_wiki.Get(m_wiki.parent_id);
                if (string.IsNullOrEmpty(m_wiki.parent_ids))
                {
                    m_wiki.parent_ids = m_wiki.parent_id + ",";
                }
                else
                {
                    m_wiki.parent_ids = m.parent_ids + m.parent_id + ",";
                }
                m_wiki.levels = m.levels + 1;
            }
            else
            {
                m_wiki.levels = 0;
            }
            var res = b_wiki.Save(m_wiki);

            if (res <= 0)
            {
                json.status = -1;
                json.msg    = "添加失败!";
                return(Json(json));
            }
            json.msg = "添加成功!";
            return(Json(json));
        }