Exemplo n.º 1
0
        public async Task <IEnumerable <Habitat.Core.ViewModels.Language.Language> > GetSupportedLanguages(string siteName)
        {
            var siteDefinition = (await _multisiteRepository.GetAll()).FirstOrDefault(s => (bool)s?.Name?.Equals(siteName, StringComparison.OrdinalIgnoreCase));

            if (siteDefinition == null)
            {
                return(Enumerable.Empty <Habitat.Core.ViewModels.Language.Language>());
            }

            return(await Task.WhenAll(
                       siteDefinition.SupportedLanguages.AsParallel().Select(async guid => await _sitecoreService.Get <Habitat.Core.ViewModels.Language.Language>(guid))));
        }
Exemplo n.º 2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var definitions = await _multisiteRepository.GetAll();

            return(View("SwitchSite", definitions));
        }