Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created Jun 1, 2022
Embed
What would you like to do?
public class PickupHandler : IRequestHandler<Pickup>
{
private readonly IShipmentRepository _shipmentRepository;
public PickupHandler(IShipmentRepository shipmentRepository)
{
_shipmentRepository = shipmentRepository;
}
public async Task<Unit> Handle(Pickup request, CancellationToken cancellationToken)
{
var shipment = await _shipmentRepository.Get(request.ShipmentId);
shipment.Pickup(request.Departed);
await _shipmentRepository.Save(shipment);
return Unit.Value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment