Пример #1
0
 public void Add(BlogEntry newBlog)
 {
     newBlog.ConvertTagListToUnprocessed();
     using (var context = new EFEntities())
     {
         EFBlogEntry forUpdate = context.BlogEntries.SingleOrDefault(p => p.BlogId == newBlog.BlogId);
         forUpdate.Title         = newBlog.Title;
         forUpdate.FullText      = newBlog.FullText;
         forUpdate.PreviewText   = newBlog.PreviewText;
         forUpdate.TagListString = newBlog.UnprocessedTags;
         forUpdate.Author        = newBlog.Author;
         forUpdate.Posted        = true;
         context.SaveChanges();
     }
 }
Пример #2
0
        public void AddToQueue(BlogEntry x)
        {
            x.ConvertTagListToUnprocessed();
            var addResult = new EFBlogEntry()
            {
                BlogId        = x.BlogId,
                DateCreated   = x.DateCreated,
                FullText      = x.FullText,
                Author        = x.Author,
                PreviewText   = x.PreviewText,
                Title         = x.Title,
                CategoryId    = x.Category.Id,
                TagListString = x.UnprocessedTags,
                Posted        = false
            };

            using (var context = new EFEntities())
            {
                context.BlogEntries.Add(addResult);
                context.SaveChanges();
            }
        }