protected override void InitializePropertiesForViewing() { using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance()) { SeoKeywords = _appConfigRepository.SeoUrlKeywords.Where( keyword => keyword.KeywordValue.Equals(InnerItem.Code) && keyword.KeywordType.Equals((int)SeoUrlKeywordTypes.Item)) .ToList(); } InnerItemCatalogLanguages.ForEach(locale => { if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale))) { var newSeoKeyword = new SeoUrlKeyword { Language = locale, IsActive = true, KeywordType = (int)SeoUrlKeywordTypes.Item, KeywordValue = InnerItem.Code, Created = DateTime.UtcNow }; SeoKeywords.Add(newSeoKeyword); } }); // filter values by locale SeoLocalesFilterCommand.Execute(InnerItem.Catalog.DefaultLanguage); }
protected virtual void InitializePropertiesForViewing() { SeoKeywords = new List <SeoUrlKeyword>(); using (var _appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance()) { _appConfigRepository.SeoUrlKeywords.Where( keyword => keyword.KeywordValue.Equals(_keywordValue, StringComparison.InvariantCultureIgnoreCase) && keyword.KeywordType.Equals((int)_keywordType) && keyword.IsActive) .ToList().ForEach(seo => { var newSeo = new SeoUrlKeyword(seo); newSeo.BaseUrl = BuildBaseUrl(newSeo); newSeo.PropertyChanged += CurrentSeoKeyword_PropertyChanged; SeoKeywords.Add(newSeo); }); } _availableLanguages.ForEach(locale => { if (!SeoKeywords.Any(keyword => keyword.Language.Equals(locale, StringComparison.InvariantCultureIgnoreCase))) { var newSeoKeyword = new SeoUrlKeyword(locale, (int)_keywordType, _keywordValue); newSeoKeyword.BaseUrl = BuildBaseUrl(newSeoKeyword); newSeoKeyword.PropertyChanged += CurrentSeoKeyword_PropertyChanged; SeoKeywords.Add(newSeoKeyword); } }); SeoLocalesFilterCommand.Execute(SeoKeywords.FirstOrDefault(x => x.Language.Equals(_defaultLanguage, StringComparison.InvariantCultureIgnoreCase))); }