Пример #1
0
        public async Task OnGet()
        {
            // *** Lo ideal sería implementar un Autocomplete para buscar los productos y cliente a demanda
            Products = await _productProxy.GetAllAsync(1, 100);

            Clients = await _clientProxy.GetAllAsync(1, 100);
        }
Пример #2
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);
        }
Пример #3
0
 public async Task <DataCollection <ProductDto> > GetAll(int page, int take)
 {
     return(await _catalogProxy.GetAllAsync(page, take));
 }