public Task HandleAsync( OrderStatusChangedToValidatedIntegrationEvent integrationEvent) { // Save the updated status in the read model and notify the client via SignalR. return(UpdateReadModelAndSendNotificationAsync(integrationEvent.OrderId, integrationEvent.OrderStatus, integrationEvent.Description, integrationEvent.BuyerId)); }
public async Task Handle(OrderStatusChangedToValidatedDomainEvent domainEvent, CancellationToken cancellationToken) { _logger.CreateLogger <OrderStatusChangedToValidatedDomainEventHandler>() .LogTrace("Order with Id: {OrderId} has been successfully updated to status {Status} ({Id})", domainEvent.OrderId, nameof(OrderStatus.Validated), OrderStatus.Validated.Id); var order = await _orderRepository.GetAsync(domainEvent.OrderId); var buyer = await _buyerRepository.FindByIdAsync(order.GetBuyerId.Value.ToString()); var integrationEvent = new OrderStatusChangedToValidatedIntegrationEvent(order.Id, order.OrderStatus.Name, buyer.Name, order.GetTotal()); await _orderingIntegrationEventService.AddAndSaveEventAsync(integrationEvent); }
public async Task OrderStarted(OrderStatusChangedToValidatedIntegrationEvent @event) { var handler = _serviceProvider.GetRequiredService <OrderStatusChangedToValidatedIntegrationEventHandler>(); await handler.Handle(@event); }
public Task HandleAsync( OrderStatusChangedToValidatedIntegrationEvent @event, [FromServices] OrderStatusChangedToValidatedIntegrationEventHandler handler) => handler.Handle(@event);