public void DeleteProductRecommendations(ICollection <EntryContentBase> entries) { if (entries == null || entries.Count == 0) { return; } if (!_configuration.ProductRecommendationsImportUrl.IsValidProductRecommendationsImportUrl()) { return; } // For each known association group, tell Ka-ching to delete all outgoing associations for the specified products. // We are doing it this way, because the import queue expects to be told which recommendation category // to delete associations from. Deleting a catalog entry from Episerver, affects all recommendation categories. foreach (var associationGroup in _associationGroupRepository.List()) { // Do the deletion in batches. foreach (var batch in entries .OfType <ProductContent>() .Batch(BatchSize)) { // Call the external endpoint asynchronously and return immediately. Task.Factory.StartNew(() => APIFacade.DeleteAsync( batch.Select(s => s.Code.SanitizeKey()), _configuration.ProductRecommendationsImportUrl + "&recommendation_id=" + associationGroup.Name.SanitizeKey()) .ConfigureAwait(false)); } } }
public void DeleteProductRecommendations(ICollection <EntryContentBase> entries) { if (entries == null) { return; } if (!_configuration.ProductRecommendationsImportUrl.IsValidProductRecommendationsImportUrl()) { return; } // For each known association group, tell Ka-ching to delete all outgoing associations for the specified products. // We are doing it this way, because the import queue expects to be told which recommendation category // to delete associations from. Deleting a catalog entry from Episerver, affects all recommendation categories. foreach (var associationGroup in _associationGroupRepository.List()) { // Do the deletion in batches. foreach (var batch in entries .Batch(BatchSize)) { APIFacade.Delete( batch.Select(s => s.Code.SanitizeKey()), _configuration.ProductRecommendationsImportUrl + "&recommendation_id=" + associationGroup.Name.SanitizeKey()); } } }