Exemplo n.º 1
0
        static async Task RunAsync()
        {
            // Update port # in the following line.
            client.BaseAddress = new Uri("10.0.2.26");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            try
            {
                // Create a new product
                Productt productt = new Productt();


                // Delete the product
                var statusCode = await DeleteProductAsync(productt.id);

                Console.WriteLine($"Deleted (HTTP Status = {(int)statusCode})");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadLine();
        }
Exemplo n.º 2
0
 static void ShowProduct(Productt productt)
 {
     Console.WriteLine($"Name: {productt.name}\tPrice: " +
                       $"{productt.price}\tCategory: {productt.category}");
 }