-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
23 lines (20 loc) · 928 Bytes
/
Program.cs
File metadata and controls
23 lines (20 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
namespace Consumer
{
class Program
{
static void Main(string[] args)
{
var ApiClient = new ApiClient(new Uri("http://localhost:9001"));
Console.WriteLine("**Retrieving product list**");
var response = ApiClient.GetAllProducts().GetAwaiter().GetResult();
var responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
Console.WriteLine($"Response.Code={response.StatusCode}, Response.Body={responseBody}\n\n");
int productId = 10;
Console.WriteLine($"**Retrieving product with id={productId}");
response = ApiClient.GetProduct(productId).GetAwaiter().GetResult();
responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
Console.WriteLine($"Response.Code={response.StatusCode}, Response.Body={responseBody}");
}
}
}