public async Task Handle(ProductCreated notification, CancellationToken cancellationToken) { _logger.LogInformation("Brimo API EventHandelr: {Name} {@UserId} {@UserName} {@Request}", nameof(ProductCreated), _currentUserService.UserId, _currentUserService.Name, notification); var productWithBrandAndCategory = await _productRepository.FindByIdAsync(notification.Product.Id.ToString()); var productToAddToAlgoia = _mapper.Map <AlgoliaProductVM>(productWithBrandAndCategory); await _searchEngine.AddEntity(productToAddToAlgoia, "dev_product3"); }
public async Task Handle(BrandCreated notification, CancellationToken cancellationToken) { _logger.LogInformation("Brimo API EventHandelr: {Name} {@UserId} {@UserName} {@Request}", nameof(BrandCreated), _currentUserService.UserId, _currentUserService.Name, notification); var brand = await _brandRepository.FindByIdAsync(notification.Brand.Id.ToString()); var brandToAddToAlgoia = _mapper.Map <AlgoliaBrandVM>(brand); await _searchEngine.AddEntity(brandToAddToAlgoia, "dev_brand"); }