Esempio n. 1
0
 private void SetLang(ArticleItemLang postLang)
 {
     Text = postLang.Text;
 }
Esempio n. 2
0
        private void CreateOrChangeContentLang(SiteContext context, ArticleItem instance, ArticleItem cache, Language lang)
        {

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

        }