-
-
Save dcomartin/70bf2f2c7c7cac39e9d7e4ae8f6a529f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GetOrderQueryHandler : IRequestHandler<GetOrderQuery, OrderResponse> | |
{ | |
private readonly IOrderReadService _orderReadService; | |
public GetOrderQueryHandler(IOrderReadService orderReadService) | |
{ | |
_orderReadService = orderReadService; | |
} | |
public async Task<OrderResponse> Handle(GetOrderQuery request, CancellationToken cancellationToken) | |
{ | |
var orderResponse = await _orderReadService.GetOrderByIdAsync(request.OrderId); | |
if (orderResponse is null) | |
{ | |
throw new OrderNotFoundException(request.OrderId); | |
} | |
return orderResponse; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment