예제 #1
0
파일: AdminBlog.cs 프로젝트: z5616342/XBlog
 public void Modify(long id, string title, bool top, string tag, long category, string sourceUrl, string content,
                    string summary)
 {
     DBModules.Blog item;
     if (id > 0)
     {
         item = DBContext.Load <DBModules.Blog>(id);
     }
     else
     {
         item = new DBModules.Blog();
     }
     if (item != null)
     {
         item.Title      = title;
         item.Top        = top;
         item.Tags       = tag;
         item.CategoryID = category;
         Category cate = DBContext.Load <Category>(category);
         if (cate != null)
         {
             item.Category = cate.Name;
         }
         item.SourceUrl = sourceUrl;
         item.Content   = content;
         item.Summary   = summary;
         item.Save();
         RefreshBlog refreshBlog = new RefreshBlog();
         refreshBlog.BlogID = item.ID;
         refreshBlog.Status = 1;
         refreshBlog.Save();
     }
 }
예제 #2
0
파일: AdminBlog.cs 프로젝트: z5616342/XBlog
 public void AllSyncToES()
 {
     foreach (DBModules.Blog item in new Expression().List <DBModules.Blog>())
     {
         RefreshBlog refreshBlog = new RefreshBlog();
         refreshBlog.BlogID = item.ID;
         refreshBlog.Status = 1;
         refreshBlog.Save();
     }
 }
예제 #3
0
파일: AdminBlog.cs 프로젝트: z5616342/XBlog
 public void Delete(long[] id)
 {
     if (id != null && id.Length > 0)
     {
         (DBModules.Blog.iD == id).Delete <DBModules.Blog>();
         (DBModules.Comment.blogID == id).Delete <DBModules.Comment>();
         foreach (var item in id)
         {
             RefreshBlog refreshBlog = new RefreshBlog();
             refreshBlog.BlogID = item;
             refreshBlog.Status = 0;
             refreshBlog.Save();
         }
     }
 }