Beispiel #1
0
 private void CreateOrChangeContentLang(SiteContainer context, Content instance, Content cache, Language lang)
 {
    
         ContentLang contenttLang = null;
         if (cache != null)
         {
             contenttLang = context.ContentLang.FirstOrDefault(p => p.ContentId == cache.Id && p.LanguageId == lang.Id);
         }
         if (contenttLang == null)
         {
             var newPostLang = new ContentLang
                                   {
                                       ContentId = instance.Id,
                                       LanguageId = lang.Id,
                                       Title = instance.Title,
                                       Text = HttpUtility.HtmlDecode(instance.Text),
                                       SeoDescription = instance.SeoDescription,
                                       SeoKeywords = instance.SeoKeywords
                                   };
             context.AddToContentLang(newPostLang);
         }
         else
         {
             contenttLang.Title = instance.Title;
             contenttLang.Text = HttpUtility.HtmlDecode(instance.Text);
             contenttLang.SeoDescription = instance.SeoDescription;
             contenttLang.SeoKeywords = instance.SeoKeywords;
         }
         context.SaveChanges();
    
 }
Beispiel #2
0
        private void CreateOrChangeContentLang(SiteContainer context, Category instance, Category cache, Language lang)
        {

            CategoryLang contenttLang = null;
            if (cache != null)
            {
                contenttLang = context.CategoryLang.FirstOrDefault(p => p.CategoryId == cache.Id && p.LanguageId == lang.Id);
            }
            if (contenttLang == null)
            {
                var newPostLang = new CategoryLang
                {
                    CategoryId = instance.Id,
                    LanguageId = lang.Id,
                    Title = instance.Title,
                };
                context.AddToCategoryLang(newPostLang);
            }
            else
            {
                contenttLang.Title = instance.Title;
            }
            context.SaveChanges();
        }
Beispiel #3
0
        private void CreateOrChangeContentLang(SiteContainer context, Brand instance, Brand cache, Language lang)
        {

            BrandLang contenttLang = null;
            if (cache != null)
            {
                contenttLang = context.BrandLang.FirstOrDefault(p => p.BrandId == cache.Id && p.LanguageId == lang.Id);
            }
            if (contenttLang == null)
            {
                var newPostLang = new BrandLang
                {
                    BrandId = instance.Id,
                    LanguageId = lang.Id,
                    Title = instance.Title,
                    Description = instance.Description
                };
                context.AddToBrandLang(newPostLang);
            }
            else
            {
                contenttLang.Title = instance.Title;
                contenttLang.Description = instance.Description;
            }
            context.SaveChanges();

        }
        private void CreateOrChangeContentLang(SiteContainer context, ArticleItem instance, ArticleItem cache, Language lang)
        {

            ArticleItemLang contenttLang = null;
            if (cache != null)
            {
                contenttLang = context.ArticleItemLang.FirstOrDefault(p => p.ArticleItemId == cache.Id && p.LanguageId == lang.Id);
            }
            if (contenttLang == null)
            {
                var newPostLang = new ArticleItemLang
                {
                    ArticleItemId = instance.Id,
                    LanguageId = lang.Id,
                    Text = HttpUtility.HtmlDecode(instance.Text)
                };
                context.AddToArticleItemLang(newPostLang);
            }
            else
            {
                contenttLang.Text = HttpUtility.HtmlDecode(instance.Text);
            }
            context.SaveChanges();

        }
        private void CreateOrChangeContentLang(SiteContainer context, BrandGroupItem instance, BrandGroupItem cache, Language lang)
        {

            BrandGroupItemLang contenttLang = null;
            if (cache != null)
            {
                contenttLang = context.BrandGroupItemLang.FirstOrDefault(p => p.BrandGroupItemId == cache.Id && p.LanguageId == lang.Id);
            }
            if (contenttLang == null)
            {
                var newPostLang = new BrandGroupItemLang
                {
                    BrandGroupItemId = instance.Id,
                    LanguageId = lang.Id,
                    Text = instance.Text
                };
                context.AddToBrandGroupItemLang(newPostLang);
            }
            else
            {
                contenttLang.Text = instance.Text;
            }
            context.SaveChanges();

        }