Beispiel #1
0
 Entry IBlogEngine.GetBlogEntry(int Id)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         return DataService.Repository.GetEntries().FirstOrDefault(BlogEntry => BlogEntry.Id == Id);
     }
 }
Beispiel #2
0
 void IBlogEngine.DeleteEntry(int id)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         DataService.RemoveBlogEntry(id);
     }
 }
Beispiel #3
0
 IEnumerable<Entry> IBlogEngine.GetBlogEntries(int blogId)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         return DataService.GetBlogEntries(blogId).OrderByDescending(entry => entry.CreateDate);
     }
 }
Beispiel #4
0
 void IBlogEngine.AddEntry(DataModels.Entry blogEntry)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         DataService.AddBlogEntry(blogEntry);
     }
 }
Beispiel #5
0
        PresentationModels.BloggerPModel IBlogEngine.GetBloggerInfo(int userId)
        {
            using (IBlogService DataService = new BlogEngineDataService(this.Config))
            {
                var Blogger = new PresentationModels.BloggerPModel()
                {
                    BloggerInfo = DataService.GetBlogger(userId)
                };

                Blogger.Blogs = DataService.GetBlogs(Blogger.BloggerInfo.Id);

                return Blogger;
            }
        }
Beispiel #6
0
 IEnumerable<Comment> IBlogEngine.GetComments(int entryId)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         return DataService.GetBlogComments(entryId).OrderBy(comment => comment.CommentDate);
     }
 }
Beispiel #7
0
 void IBlogEngine.RespondToComment(Comment response)
 {
     if (response.EntryId != 0 && (response.ResponseId != null && response.ResponseId != 0))
     {
         using (IBlogService DataService = new BlogEngineDataService(this.Config))
         {
             var Entry = DataService.Repository.GetEntries().Where(BEntry => BEntry.Id == response.EntryId).FirstOrDefault();
             var Comment = DataService.Repository.GetComments().Where(BCom => BCom.Id == response.ResponseId).FirstOrDefault();
             if (Entry != null && Comment != null)
                 DataService.AddComment(response);
         }
     }
 }
Beispiel #8
0
 void IBlogEngine.RegisterBlogger(Blogger blogger)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         DataService.RegisterBlogger(blogger);
     }
 }
Beispiel #9
0
 void IBlogEngine.LeaveComment(Comment comment)
 {
     if (comment.EntryId != 0)
     {
         using (IBlogService DataService = new BlogEngineDataService(this.Config))
         {
             var Entry = DataService.Repository.GetEntries().Where(BEntry => BEntry.Id == comment.EntryId).FirstOrDefault();
             if(Entry != null)
                 DataService.AddComment(comment);
         }
     }
 }
Beispiel #10
0
 bool IBlogEngine.IsBloggerRegistered(int userId)
 {
     using (IBlogService DataService = new BlogEngineDataService(this.Config))
     {
         return DataService.IsBloggerRegistered(userId);
     }
 }