Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created April 8, 2026 16:40
Show Gist options
  • Select an option

  • Save dcomartin/01de27b4810c573777416f410e7b51f3 to your computer and use it in GitHub Desktop.

Select an option

Save dcomartin/01de27b4810c573777416f410e7b51f3 to your computer and use it in GitHub Desktop.
public class FulfillOrder
{
private readonly IOrderRepository _repository;
private readonly IMapper _mapper;
public FulfillOrder(IOrderRepository repository, IMapper mapper)
{
_repository = repository;
_mapper = mapper;
}
public async Task Handle(int orderId)
{
var entity = await _repository.GetById(orderId);
var domain = _mapper.Map<Order>(entity);
domain.Fulfill();
await _repository.Update(_mapper.Map<OrderEntity>(domain));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment