Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 1, 2022 21:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dcomartin/0e65bfe8beca419e7b7b8db5c4e3c9a5 to your computer and use it in GitHub Desktop.
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