Beispiel #1
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));
        }
Beispiel #2
0
 public void Update(Domain.Wiki model)
 {
     dal.Update(model);
 }
Beispiel #3
0
 public int Save(Domain.Wiki model)
 {
     return(Convert.ToInt32(dal.Save(model)));
 }