Ejemplo n.º 1
0
        private void CreateOrChangeContentLang(SiteContainer context, Article instance, Article cache, Language lang)
        {
            ArticleLang contenttLang = null;
            if (cache != null)
            {
                contenttLang = context.ArticleLang.FirstOrDefault(p => p.ArticleId == cache.Id && p.LanguageId == lang.Id);
            }
            if (contenttLang == null)
            {
                var newPostLang = new ArticleLang
                {
                    ArticleId = instance.Id,
                    LanguageId = lang.Id,
                    Title = instance.Title,
                    Description = HttpUtility.HtmlDecode(instance.Description)
                };
                context.AddToArticleLang(newPostLang);




            }
            else
            {
                contenttLang.Title = instance.Title;
                contenttLang.Description = HttpUtility.HtmlDecode(instance.Description);
            }
            context.SaveChanges();

        }