public void UpdateSeoKeywords() { //if any SEO keyword modified update or add it if (_seoModified) { using (var appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance()) { SeoKeywords.ForEach(keyword => { if (!string.IsNullOrEmpty(keyword.Keyword)) { var originalKeyword = appConfigRepository.SeoUrlKeywords.Where( seoKeyword => true && seoKeyword.SeoUrlKeywordId.Equals(keyword.SeoUrlKeywordId)) .FirstOrDefault(); if (originalKeyword != null) { originalKeyword.InjectFrom <CloneInjection>(keyword); appConfigRepository.Update(originalKeyword); } else { var addKeyword = CreateSeoUrlKeyword(keyword.Language); addKeyword.InjectFrom(keyword); appConfigRepository.Add(addKeyword); } } }); appConfigRepository.UnitOfWork.Commit(); } OnPropertyChanged("NavigateUri"); _seoModified = false; } }
public void UpdateSeoKeywords() { //if item code changed - need to update SEO KeywordValue property, if any if (!OriginalItem.Code.Equals(InnerItem.Code)) { if (SeoKeywords.Any(kw => !string.IsNullOrEmpty(kw.Keyword))) { if (CurrentSeoKeyword != null) { CurrentSeoKeyword.PropertyChanged -= CurrentSeoKeyword_PropertyChanged; } _seoModified = true; SeoKeywords.ForEach(keyword => { if (!string.IsNullOrEmpty(keyword.Keyword)) { keyword.KeywordValue = InnerItem.Code; } }); if (CurrentSeoKeyword != null) { CurrentSeoKeyword.PropertyChanged -= CurrentSeoKeyword_PropertyChanged; } } } //if any SEO keyword modified update or add it if (_seoModified) { using (var appConfigRepository = _appConfigRepositoryFactory.GetRepositoryInstance()) { SeoKeywords.ForEach(keyword => { if (!string.IsNullOrEmpty(keyword.Keyword)) { var originalKeyword = appConfigRepository.SeoUrlKeywords.Where( seoKeyword => true && seoKeyword.SeoUrlKeywordId.Equals(keyword.SeoUrlKeywordId)) .FirstOrDefault(); if (originalKeyword != null) { originalKeyword.InjectFrom <CloneInjection>(keyword); appConfigRepository.Update(originalKeyword); } else { var addKeyword = _appConfigEntityFactory.CreateEntity <SeoUrlKeyword>(); addKeyword.InjectFrom(keyword); appConfigRepository.Add(addKeyword); } } }); appConfigRepository.UnitOfWork.Commit(); } OnPropertyChanged("NavigateUri"); _seoModified = false; } }
public void UpdateKeywordValueCode(string newCode) { SeoKeywords.ForEach(x => x.KeywordValue = newCode); }