コード例 #1
0
        private async Task <TagElasticModel> MapToElasticModel(TagCmsModel m)
        {
            var languages = await _cmsApiProxy.GetLanguages();

            var defaultLanguage = languages.FirstOrDefault(x => x.Default)?.Code;

            var languageCode = await _cmsApiProxy.ExtractLanguageFromUrl(m.Link);

            if (string.IsNullOrEmpty(languageCode))
            {
                languageCode = defaultLanguage;
            }

            return(new TagElasticModel
            {
                Id = m.Id,
                Name = WebUtility.HtmlDecode(m.Title?.Rendered),
                Slug = m.Slug,
                LanguageCode = languageCode,
                TagGroupId = m.Grupp
            });
        }