Example #1
0
        private static async Task DeleteUsers(IDocumentClient client)
        {
            Console.WriteLine("Deleting users");
            Uri databaseUri          = UriFactory.CreateDatabaseUri("mydb");
            IEnumerable <User> users = client.CreateUserQuery(databaseUri).AsEnumerable();

            foreach (User user in users)
            {
                await client.DeleteUserAsync(user.SelfLink);
            }
        }
        // Users

        private static void ListUsers(IDocumentClient client)
        {
            Console.WriteLine(">>> View Users in mydb <<<");

            List <User> users = client.CreateUserQuery(MyDbDatabaseUri).ToList();

            int i = 0;

            foreach (User user in users)
            {
                i++;
                Console.WriteLine();
                Console.WriteLine($" User #{i}");
                PrintUser(user);
            }

            Console.WriteLine();
            Console.WriteLine($"Total users in database mydb: {users.Count}");
        }