public async Task <MediatR.Unit> Handle(SyncProductsWithAlgoliaCommand request, CancellationToken cancellationToken) { var products = _searchEngine.ListProducts(); _productRepository.DeleteAll(); _brandRepository.DeleteAll(); _productCategoryRepository.DeleteAll(); _brandRepository.AddRange(products.Item1); _productCategoryRepository.AddRange(products.Item2); _productRepository.AddRange(products.Item3); await _productRepository.UnitOfWork.SaveEntitiesSeveralTransactionsAsync(cancellationToken); return(MediatR.Unit.Value); }
public async Task AddRange(IEnumerable <Brand> brands) { await _brandRepository.AddRange(brands); }