Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created March 9, 2022 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/5bbd38ba40e44778277d6880a26a41c6 to your computer and use it in GitHub Desktop.
Save dcomartin/5bbd38ba40e44778277d6880a26a41c6 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.StopId, 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