-
-
Save dcomartin/01de27b4810c573777416f410e7b51f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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