Exemplo n.º 1
0
 public override void Published(PublishContentContext context, AutoroutePart instance)
 {
     if (!String.IsNullOrWhiteSpace(instance.Path))
     {
         _entries.AddEntry(instance.ContentItem.ContentItemId, instance.Path);
     }
 }
Exemplo n.º 2
0
        public override void Published(PublishContentContext context, AutoroutePart part)
        {
            if (!String.IsNullOrWhiteSpace(part.Path))
            {
                _entries.AddEntry(part.ContentItem.ContentItemId, part.Path);
            }

            if (part.SetHomepage)
            {
                var site      = _siteService.GetSiteSettingsAsync().GetAwaiter().GetResult();
                var homeRoute = site.HomeRoute;

                homeRoute["area"]          = "Orchard.Contents";
                homeRoute["controller"]    = "Item";
                homeRoute["action"]        = "Display";
                homeRoute["contentItemId"] = context.ContentItem.ContentItemId;

                // Once we too the flag into account we can dismiss it.
                part.SetHomepage = false;
                _siteService.UpdateSiteSettingsAsync(site).GetAwaiter().GetResult();
            }

            // Evict any dependent item from cache
            RemoveTag(part);
        }
Exemplo n.º 3
0
        public override async Task PublishedAsync(PublishContentContext context, AutoroutePart part)
        {
            if (!String.IsNullOrWhiteSpace(part.Path))
            {
                _entries.AddEntry(part.ContentItem.ContentItemId, part.Path);
            }

            if (part.SetHomepage)
            {
                var site = await _siteService.GetSiteSettingsAsync();

                if (site.HomeRoute == null)
                {
                    site.HomeRoute = new RouteValueDictionary();
                }

                var homeRoute = site.HomeRoute;

                foreach (var entry in _options.GlobalRouteValues)
                {
                    homeRoute[entry.Key] = entry.Value;
                }

                homeRoute[_options.ContentItemIdKey] = context.ContentItem.ContentItemId;

                // Once we too the flag into account we can dismiss it.
                part.SetHomepage = false;
                await _siteService.UpdateSiteSettingsAsync(site);
            }

            // Evict any dependent item from cache
            await RemoveTagAsync(part);
        }