Example #1
0
 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();
     }
 }
Example #2
0
 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();
     }
 }
Example #3
0
 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();
         }
     }
 }