private void CreateOrChangeContentLang(SiteContainer context, Brand instance, Brand cache, Language lang) { BrandLang contenttLang = null; if (cache != null) { contenttLang = context.BrandLang.FirstOrDefault(p => p.BrandId == cache.Id && p.LanguageId == lang.Id); } if (contenttLang == null) { var newPostLang = new BrandLang { BrandId = instance.Id, LanguageId = lang.Id, Title = instance.Title, Description = instance.Description }; context.AddToBrandLang(newPostLang); } else { contenttLang.Title = instance.Title; contenttLang.Description = instance.Description; } context.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the BrandLang EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBrandLang(BrandLang brandLang) { base.AddObject("BrandLang", brandLang); }
private void SetLang(BrandLang postLang) { Title = postLang.Title; Description = postLang.Description; }
/// <summary> /// Create a new BrandLang object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="languageId">Initial value of the LanguageId property.</param> /// <param name="brandId">Initial value of the BrandId property.</param> public static BrandLang CreateBrandLang(global::System.Int32 id, global::System.String title, global::System.Int32 languageId, global::System.Int32 brandId) { BrandLang brandLang = new BrandLang(); brandLang.Id = id; brandLang.Title = title; brandLang.LanguageId = languageId; brandLang.BrandId = brandId; return brandLang; }