/// <summary> /// Updates the update map object. /// </summary> /// <param name="objectTranslationData">The object translation data.</param> public void UpdateMapObject(MapObjectTranslationData objectTranslationData) { var translation = DataContext.MapObjectTranslations.FirstOrDefault(f => f.MapObjectId == objectTranslationData.MapObjectId); if (translation != null) { translation.Value = objectTranslationData.Value; translation.LanguageId = objectTranslationData.LanguageId; DataContext.SaveChanges(); } }
/// <summary> /// Creates the translation with region node. /// </summary> /// <param name="objectTranslationData">The object translation data.</param> public void CreateTranslationWithRegionNode(MapObjectTranslationData objectTranslationData) { if (objectTranslationData.CityNodeId != 0) { return; } if (!DataContext.RegionNodes.Any(e => e.LanguageKey == objectTranslationData.LanguageKey)) { var newCity = new RegionNode { LanguageKey = objectTranslationData.LanguageKey }; DataContext.AddDataObject(newCity); DataContext.SaveChanges(); } var newTranslation = new MapObjectTranslation { LanguageKey = objectTranslationData.LanguageKey, LanguageId = objectTranslationData.LanguageId, Value = objectTranslationData.Value }; DataContext.AddTranslationObject(newTranslation); DataContext.SaveChanges(); }