28 lines
820 B
C#
28 lines
820 B
C#
|
using Basket.API.IntegrationEvents.Events;
|
|||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
|||
|
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Basket.API.IntegrationEvents.EventHandling
|
|||
|
{
|
|||
|
public class OrderStartedIntegrationEventHandler : IIntegrationEventHandler<OrderStartedIntegrationEvent>
|
|||
|
{
|
|||
|
private readonly IBasketRepository _repository;
|
|||
|
public OrderStartedIntegrationEventHandler(IBasketRepository repository)
|
|||
|
{
|
|||
|
_repository = repository;
|
|||
|
}
|
|||
|
|
|||
|
public async Task Handle(OrderStartedIntegrationEvent @event)
|
|||
|
{
|
|||
|
await _repository.DeleteBasketAsync(@event.UserId.ToString());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|