public async Task <OrderDto> Get(int id) { var result = await _orderProxy.GetAsync(id); // Retrieve client result.Client = await _customerProxy.GetAsync(result.ClientId); // Retrieve product ids var productIds = result.Items .Select(x => x.ProductId) .GroupBy(g => g) .Select(x => x.Key).ToList(); if (result.Items.Count() > 0) { var products = await _catalogProxy.GetAllAsync(1, productIds.Count(), productIds); foreach (var item in result.Items) { item.Product = products.Items.Single(x => x.ProductId == item.ProductId); } } return(result); }
public async Task OnGet(int id) { Order = await _orderProxy.GetAsync(id); }