Exemplo n.º 1
0
        void ContentService_Deleted(IContentService sender, Umbraco.Core.Events.DeleteEventArgs<Umbraco.Core.Models.IContent> e)
        {
            var fs = new ForumService(ApplicationContext.Current.DatabaseContext);
            foreach (var ent in e.DeletedEntities.Where(x => x.ContentType.Alias == "Forum"))
            {

                var f = fs.GetById(ent.Id);
                if (f != null)
                    fs.Delete(f);
            }
        }
Exemplo n.º 2
0
        void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<Umbraco.Core.Models.IContent> e)
        {
            var fs = new ForumService(ApplicationContext.Current.DatabaseContext);
            foreach (var ent in e.PublishedEntities.Where(x => x.ContentType.Alias == "Forum"))
            {
                Models.Forum f = fs.GetById(ent.Id);

                if (f == null)
                {
                    f = new Models.Forum();
                    f.Id = ent.Id;
                    f.ParentId = ent.ParentId;
                    f.SortOrder = ent.SortOrder;
                    f.TotalTopics = 0;
                    f.TotalComments = 0;
                    f.LatestPostDate = DateTime.Now;
                    f.LatestAuthor = 0;
                    f.LatestComment = 0;
                    f.LatestTopic = 0;
                    fs.Save(f);
                }
            }
        }
Exemplo n.º 3
0
 protected ForumControllerBase()
 {
     TopicService = new TopicService(DatabaseContext);
     CommentService = new CommentService(DatabaseContext, TopicService);
     ForumService = new ForumService(DatabaseContext);
 }