using Basket.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.Services.Basket.API.Model; using System; using System.Threading.Tasks; namespace Basket.API.IntegrationEvents.EventHandling { public class OrderStartedIntegrationEventHandler : IIntegrationEventHandler { private readonly IBasketRepository _repository; public OrderStartedIntegrationEventHandler(IBasketRepository repository) { _repository = repository ?? throw new ArgumentNullException(nameof(repository)); } public async Task Handle(OrderStartedIntegrationEvent @event) { await _repository.DeleteBasketAsync(@event.UserId.ToString()); } } }