Пример #1
0
        private async Task <List <Models.ContactDetails> > GetAllContacts()
        {
            var collectionUri = _documentDbHelper.CreateSourceContactDocumentCollectionUri();
            var client        = _databaseClient.CreateSourceDocumentClient();

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

            var queryCont = client.CreateDocumentQuery <Models.ContactDetails>(collectionUri).AsDocumentQuery();
            var contacts  = new List <Models.ContactDetails>();

            while (queryCont.HasMoreResults)
            {
                var response = await queryCont.ExecuteNextAsync <Models.ContactDetails>();

                contacts.AddRange(response);
            }

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