コード例 #1
0
        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();

        }
コード例 #2
0
ファイル: Site.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Deprecated Method for adding a new object to the ArticleItemLang EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToArticleItemLang(ArticleItemLang articleItemLang)
 {
     base.AddObject("ArticleItemLang", articleItemLang);
 }
コード例 #3
0
ファイル: ArticleItem.cs プロジェクト: fathurxzz/aleqx
 private void SetLang(ArticleItemLang postLang)
 {
     Text = postLang.Text;
 }
コード例 #4
0
ファイル: Site.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <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;
 }