コード例 #1
0
        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);
        }
コード例 #2
0
 public async Task <ClientDto> Get(int id)
 {
     return(await customerProxy.GetAsync(id));
 }