void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs <IContent> e) { foreach (var item in e.PublishedEntities.Where(x => x.ContentType.Alias == "Project")) { UpdateProjectExamineIndex(item); } }
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); } } }
void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs <Umbraco.Core.Models.IContent> e) { const string publishedDateKey = "publishedDate"; var contentService = ApplicationContext.Current.Services.ContentService; foreach (var content in e.PublishedEntities.Where(x => x.HasProperty(publishedDateKey))) { var existingValue = content.GetValue(publishedDateKey); if (existingValue == null) { content.SetValue(publishedDateKey, DateTime.Now); contentService.SaveAndPublishWithStatus(content, raiseEvents: false); } } }
private void ContentService_Publishing(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs <Umbraco.Core.Models.IContent> e) { var contentService = ApplicationContext.Current.Services.ContentService; foreach (var content in e.PublishedEntities.Where(m => m.HasProperty("publishDate"))) { var existingValue = content.GetValue("publishDate"); if (existingValue == null) { content.SetValue("publishDate", DateTime.Now); } } }
private void ContentService_Publishing(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs <Umbraco.Core.Models.IContent> e) { }