Ejemplo n.º 1
0
        private IEnumerable <KeyValuePair <SiteCulture, string> >?GetNonDatabaseUrlVariants(string searchPath)
        {
            var cultures = _siteCultureRepository.GetAll();
            var segments = searchPath.Split('/');

            if (cultures.Any(culture => culture.IsoCode?.Equals(segments?[1], StringComparison.InvariantCultureIgnoreCase) == true))
            {
                var trailingPath = string.Join('/', segments.Skip(2));

                return(cultures.Select(culture => new KeyValuePair <SiteCulture, string>(culture, $"/{culture.IsoCode?.ToLower()}/{trailingPath}")));
            }

            return(null);
        }
        /// <summary>
        /// Gets navigation hierarchies for all cultures, based on data provided by the CTB router.
        /// </summary>
        /// <returns>All navigation hierarchies.</returns>
        private Dictionary <SiteCulture, NavigationItem> GetContentTreeNavigation()
        {
            var cultures = _cultureRepository.GetAll();
            var cultureSpecificNavigations = new Dictionary <SiteCulture, NavigationItem>();

            if (cultures != null && cultures.Any())
            {
                foreach (var culture in cultures)
                {
                    cultureSpecificNavigations.Add(culture, GetContentTreeNavigation(culture));
                }
            }

            return(cultureSpecificNavigations);
        }