-
-
Save dcomartin/e96dd82e8dc20a8dc835deb2e220f8dd to your computer and use it in GitHub Desktop.
This file contains 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<Option<OrderViewModel>> Handle(GetOrderDetails request, CancellationToken cancellationToken) | |
{ | |
var order = await _orderRepository.GetByIdAsync(request.OrderId, cancellationToken); | |
if (order == null) | |
{ | |
return Option.None<OrderViewModel>(); | |
} | |
var result = 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() | |
}; | |
return result.Some(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment