Last active
April 8, 2019 15:58
-
-
Save jbogard/7db553205f54a1d8ac0b64a7c91437f7 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
var orderRequest = await _orderRepository.GetItemAsync(id); | |
orderRequest.Approve(); | |
await _orderRepository.UpdateItemAsync(orderRequest); | |
foreach (var lineItem in orderRequest.Items) | |
{ | |
var stock = (await _stockRepository | |
.GetItemsAsync(s => s.ProductId == lineItem.ProductId)) | |
.Single(); | |
stock.QuantityAvailable -= lineItem.Quantity; | |
await _stockRepository.UpdateItemAsync(stock); | |
} | |
_client.Publish(new OrderApproved { OrderId = orderRequest.Id }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment