/// <summary> /// 删除 文章 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Del(int?id) { var userinfo = BLLSession.UserInfoSessioin; List <Blogs> blogs = new List <Blogs>(); bool isdelok = false; if (null != id) { BLL.BlogsBLL blogbll = new BlogsBLL(); BLL.BlogTagsBLL tagbll = new BlogTagsBLL(); var delBlog = blogbll.GetList(t => t.BlogId == id, isAsNoTracking: false).FirstOrDefault(); List <BlogTags> tagList = delBlog.BlogTags.ToList(); //blogbll.Mod(new Blogs() { BlogId = (int)id,IsDel=true }, "IsDel"); try { foreach (var tag in tagList) { if (tag.Blogs.Count(t => !t.IsDel) <= 1) { isdelok = tagbll.Del(tag, isAsTracking: false); } } blogbll.Del(delBlog, isAsTracking: false); isdelok = blogbll.save() > 0; BLL.DataCache.GetAllType(true); } catch (Exception ex) { isdelok = false; return(Content(ex.ToString())); } } return(Content((isdelok).ToString())); }
/// <summary> /// 删除 文章 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Del(int?id) { var userinfo = BLLSession.UserInfoSessioin; List <BlogsDTO> blogs = new List <BlogsDTO>(); int isdelok = -1; if (null != id) { BLL.BlogsBLL blogbll = new BlogsBLL(); blogbll.Del(new ModelDB.Blogs() { Id = (int)id }, true); isdelok = blogbll.save(false); List <SearchResult> list = new List <SearchResult>(); list.Add(new SearchResult() { id = (int)id }); SafetyWriteHelper <SearchResult> .logWrite(list, PanGuLuceneHelper.instance.Delete); } return(Content((isdelok > 0).ToString())); }
/// <summary> /// 删除 文章 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Del(int? id) { var userinfo = BLLSession.UserInfoSessioin; List<BlogsDTO> blogs = new List<BlogsDTO>(); int isdelok = -1; if (null != id) { BLL.BlogsBLL blogbll = new BlogsBLL(); blogbll.Del(new ModelDB.Blogs() { Id = (int)id }, true); isdelok = blogbll.save(false); List<SearchResult> list = new List<SearchResult>(); list.Add(new SearchResult() { id = (int)id }); SafetyWriteHelper<SearchResult>.logWrite(list, PanGuLuceneHelper.instance.Delete); } return Content((isdelok > 0).ToString()); }