Exemple #1
0
        private async Task <List <Models.Address> > GetAllAddresses()
        {
            var collectionUri = _documentDbHelper.CreateSourceAddressDocumentCollectionUri();
            var client        = _databaseClient.CreateSourceDocumentClient();

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

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

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

                addresses.AddRange(response);
            }

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