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(); }
/// <summary> /// Deprecated Method for adding a new object to the ArticleLang EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToArticleLang(ArticleLang articleLang) { base.AddObject("ArticleLang", articleLang); }
private void SetLang(ArticleLang postLang) { Title = postLang.Title; Description = postLang.Description; }
/// <summary> /// Create a new ArticleLang object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="languageId">Initial value of the LanguageId property.</param> /// <param name="articleId">Initial value of the ArticleId property.</param> public static ArticleLang CreateArticleLang(global::System.Int32 id, global::System.String title, global::System.String description, global::System.Int32 languageId, global::System.Int32 articleId) { ArticleLang articleLang = new ArticleLang(); articleLang.Id = id; articleLang.Title = title; articleLang.Description = description; articleLang.LanguageId = languageId; articleLang.ArticleId = articleId; return articleLang; }