public override void CreateDependencies(Localization entity) { var baseObjectRepository = new BaseObjectRepository(Context); if (!baseObjectRepository.IsItNew(entity.BaseObject)) { var existingBaseObject = baseObjectRepository.GetExistingEntity(entity.BaseObject); if (existingBaseObject != null) { entity.BaseObject = existingBaseObject; } } var languageRepository = new LanguageRepository(Context); if (!languageRepository.IsItNew(entity.Language)) { var existingLanguage = languageRepository.GetExistingEntity(entity.Language); if (existingLanguage == null) { languageRepository.ChangeEntityState(entity.Language, EntityState.Unchanged); } else { entity.Language = existingLanguage; } } else { languageRepository.Create(entity.Language); } }
public override void CreateUpdateOrDeleteGraph(Localization entity) { var languageRepository = new LanguageRepository(Context); if (languageRepository.IsItNew(entity.Language)) { languageRepository.Create(entity.Language); } else { languageRepository.Update(entity.Language); } }