private void ProcessFavorite(ImportContext context) { this.ImportToPersistence(context.ToPerisist); IEnumerable<string> validGroupNames = this.SelectValidGroupNames(context.ToImport); AddFavoriteIntoGroups(this.persistence, context.ToPerisist, validGroupNames); context.Imported = true; }
private void TryProcessFavorite(ImportContext context) { context.ToPerisist = ModelConverterV1ToV2.ConvertToFavorite(context.ToImport, this.persistence); ValidationStates results = Validations.Validate(context.ToPerisist); if (results.Empty) this.ProcessFavorite(context); else LogFavoriteImportError(results, context.ToPerisist); }
private int ImportAllToPeristence(List<FavoriteConfigurationElement> configFavoritesToImport) { this.persistence.StartDelayedUpdate(); int importedCount = 0; foreach (FavoriteConfigurationElement configFavorite in configFavoritesToImport) { var context = new ImportContext(configFavorite); this.TryProcessFavorite(context); if (context.Imported) importedCount++; } this.persistence.SaveAndFinishDelayedUpdate(); return importedCount; }