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(); }
/// <summary> /// Deprecated Method for adding a new object to the ArticleItemLang EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToArticleItemLang(ArticleItemLang articleItemLang) { base.AddObject("ArticleItemLang", articleItemLang); }
private void SetLang(ArticleItemLang postLang) { Text = postLang.Text; }
/// <summary> /// Create a new ArticleItemLang object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="text">Initial value of the Text property.</param> /// <param name="articleItemId">Initial value of the ArticleItemId property.</param> /// <param name="languageId">Initial value of the LanguageId property.</param> public static ArticleItemLang CreateArticleItemLang(global::System.Int32 id, global::System.String text, global::System.Int32 articleItemId, global::System.Int32 languageId) { ArticleItemLang articleItemLang = new ArticleItemLang(); articleItemLang.Id = id; articleItemLang.Text = text; articleItemLang.ArticleItemId = articleItemId; articleItemLang.LanguageId = languageId; return articleItemLang; }