private void CreateOrChangeContentLang(SiteContext context, ProductTextBlock instance, ProductTextBlock cache, Language lang) { ProductTextBlockLang productLang = null; if (cache != null) { productLang = context.ProductTextBlockLangs.FirstOrDefault(p => p.ProductTextBlockId == cache.Id && p.LanguageId == lang.Id); } if (productLang == null) { var newPostLang = new ProductTextBlockLang { ProductTextBlockId = instance.Id, LanguageId = lang.Id, Text = instance.Text, Title = instance.Title }; context.ProductTextBlockLangs.Add(newPostLang); } else { productLang.Text = instance.Text; productLang.Title = instance.Title; } context.SaveChanges(); }
private void SetLang(ProductTextBlockLang postLang) { Text = postLang.Text; Title = postLang.Title; }