-
-
Save dcomartin/9bb1be090802ca8aebe2a8a6ea3d2f93 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 async Task<OrderViewModel> Handle(GetOrderDetails request, CancellationToken cancellationToken) | |
{ | |
var order = await _orderRepository.GetByIdAsync(request.OrderId, cancellationToken); | |
if (order == null) | |
{ | |
throw new Exception("This is a land mine."); | |
} | |
return new OrderViewModel | |
{ | |
OrderDate = order.OrderDate, | |
OrderItems = order.OrderItems.Select(oi => new OrderItemViewModel | |
{ | |
PictureUrl = oi.ItemOrdered.PictureUri, | |
ProductId = oi.ItemOrdered.CatalogItemId, | |
ProductName = oi.ItemOrdered.ProductName, | |
UnitPrice = oi.UnitPrice, | |
Units = oi.Units | |
}).ToList(), | |
OrderNumber = order.Id, | |
ShippingAddress = order.ShipToAddress, | |
Total = order.Total() | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment