예제 #1
0
        private async Task <List <Models.Customer> > GetAllCustomers()
        {
            var collectionUri = _documentDbHelper.CreateSourceCustomerDocumentCollectionUri();
            var client        = _databaseClient.CreateSourceDocumentClient();

            if (client == null)
            {
                return(null);
            }

            var queryCust = client.CreateDocumentQuery <Models.Customer>(collectionUri).AsDocumentQuery();
            var customers = new List <Models.Customer>();

            while (queryCust.HasMoreResults)
            {
                var response = await queryCust.ExecuteNextAsync <Models.Customer>();

                customers.AddRange(response);
            }

            return(customers.Any() ? customers : null);
        }