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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 public void UpdateKeywordValueCode(string newCode)
 {
     SeoKeywords.ForEach(x => x.KeywordValue = newCode);
 }