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 OnGet() { Orders = await _orderProxy.GetAllAsync(CurrentPage, 10); }