private void SetLang(SpecialContentLang postLang) { Title = postLang.Title; Text = postLang.Text; }
private void CreateOrChangeContentLang(SiteContext context, SpecialContent instance, SpecialContent cache, Language lang) { SpecialContentLang specialContentLang = null; if (cache != null) { specialContentLang = context.SpecialContentLangs.FirstOrDefault(p => p.SpecialContentId == cache.Id && p.LanguageId == lang.Id); } if (specialContentLang == null) { var newPostLang = new SpecialContentLang { SpecialContentId = instance.Id, LanguageId = lang.Id, Title = instance.Title, Text = instance.Text }; context.SpecialContentLangs.Add(newPostLang); } else { specialContentLang.Title = instance.Title; specialContentLang.Text = instance.Text; } context.SaveChanges(); }