Exemplo n.º 1
0
        static void Main()
        {
            var data = new MusicCatalogData();

            using (var client = new HttpClient())
            {
                Console.Write("Enter the port of the localhost: ");
                var port       = int.Parse(Console.ReadLine().Trim());
                var connection = new Uri(string.Format("http://localhost:{0}/", port));
                client.BaseAddress = connection;

                PostRequests(client);

                PrintJson(client, connection, "Artists");
                PrintJson(client, connection, "Albums");
                PrintJson(client, connection, "Songs");

                PrintXml(connection, "Artists");
                PrintXml(connection, "Albums");
                PrintXml(connection, "Songs");
                Console.ReadLine();
            }
        }
        static void Main()
        {
            var data = new MusicCatalogData();

            using (var client = new HttpClient())
            {

                Console.Write("Enter the port of the localhost: ");
                var port = int.Parse(Console.ReadLine().Trim());
                var connection = new Uri(string.Format("http://localhost:{0}/", port));
                client.BaseAddress = connection;

                PostRequests(client);

                PrintJson(client, connection, "Artists");
                PrintJson(client, connection, "Albums");
                PrintJson(client, connection, "Songs");

                PrintXml(connection, "Artists");
                PrintXml(connection, "Albums");
                PrintXml(connection, "Songs");
                Console.ReadLine();
            }
        }