コード例 #1
0
        static void Main(string[] args)
        {
            HttpClient client = new HttpClient();

            InitialClass initialClass = new InitialClass(client);

            initialClass.PrintInitial();
            string monitorName = initialClass.Process();

            Console.WriteLine("\n\nPlease provide us some details to contact you later");

            PatientMonitorCustomer customer = new PatientMonitorCustomer();

            customer.monitor = monitorName;
            CustomerInfo details = new CustomerInfo(client);

            details.SaveDetails(customer);
        }
コード例 #2
0
        public void SaveDetails(PatientMonitorCustomer customer)
        {
            Console.WriteLine("\nMay I know your name");
            customer.name = Console.ReadLine();

            Console.WriteLine("\nYour contact");
            customer.contact = Console.ReadLine();

            Console.WriteLine("\nYour hospital and address");
            customer.address = Console.ReadLine();
            Console.WriteLine("\nThank you " + customer.name + "!");

            var response3 = client.PostAsJsonAsync("http://localhost:52413/Customer/SaveCustomer", customer).Result;

            if (response3.IsSuccessStatusCode)
            {
                Console.WriteLine("We'll contact you asap.");
            }
            else
            {
                Console.WriteLine("{0} ({1})", (int)response3.StatusCode, response3.ReasonPhrase);
            }
        }