Example #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);
        }
        public async Task <DataCollection <OrderDto> > GetAll(int page, int take)
        {
            var result = await _orderProxy.GetAllAsync(page, take);

            if (result.HasItems)
            {
                // Retrieve client ids
                var clientIds = result.Items
                                .Select(x => x.ClientId)
                                .GroupBy(g => g)
                                .Select(x => x.Key).ToList();

                var clients = await _customerProxy.GetAllAsync(1, clientIds.Count(), clientIds);

                foreach (var order in result.Items)
                {
                    order.Client = clients.Items.Single(x => x.ClientId == order.ClientId);
                }
            }

            return(result);
        }
 public async Task <DataCollection <ClientDto> > GetAll(int page, int take)
 {
     return(await customerProxy.GetAllAsync(page, take));
 }