回答編集履歴
3
typo
test
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
var provisional = new User() { Age = 20, Name = "太郎" };
|
38
38
|
|
39
|
-
var created = await
|
39
|
+
var created = await CreateUserAsync(provisional);
|
40
40
|
|
41
41
|
//TODO: write any codes
|
42
42
|
|
2
コード修正
test
CHANGED
@@ -78,13 +78,11 @@
|
|
78
78
|
|
79
79
|
{
|
80
80
|
|
81
|
-
var provisional = new User() { Age = 20, Name = "太郎" };
|
82
|
-
|
83
|
-
// UserApi class is automatically generated by Swagger Codegen
|
81
|
+
// User, UserApi class is automatically generated by Swagger Codegen
|
84
82
|
|
85
83
|
var userApi = new UserApi(_serverUrl);
|
86
84
|
|
87
|
-
var user = await userApi.PostUserAsync(
|
85
|
+
var user = await userApi.PostUserAsync(20, "太郎");
|
88
86
|
|
89
87
|
//TODO: write any codes
|
90
88
|
|
1
コード修正
test
CHANGED
@@ -10,15 +10,17 @@
|
|
10
10
|
|
11
11
|
```C#
|
12
12
|
|
13
|
+
private static readonly HttpClient _client = new HttpClient();
|
14
|
+
|
13
|
-
private static string
|
15
|
+
private static readonly string _serverUrl = "http://localhost/jsonDebug.php/";
|
14
16
|
|
15
17
|
|
16
18
|
|
17
|
-
static async Task<User> CreateUserAsync(User user)
|
19
|
+
private static async Task<User> CreateUserAsync(User user)
|
18
20
|
|
19
21
|
{
|
20
22
|
|
21
|
-
var response = await client.PostAsJsonAsync(
|
23
|
+
var response = await _client.PostAsJsonAsync(_serverUrl, user);
|
22
24
|
|
23
25
|
response.EnsureSuccessStatusCode();
|
24
26
|
|
@@ -68,7 +70,7 @@
|
|
68
70
|
|
69
71
|
```C#
|
70
72
|
|
71
|
-
private static string
|
73
|
+
private static readonly string _serverUrl = "http://localhost/jsonDebug.php/";
|
72
74
|
|
73
75
|
|
74
76
|
|
@@ -80,7 +82,7 @@
|
|
80
82
|
|
81
83
|
// UserApi class is automatically generated by Swagger Codegen
|
82
84
|
|
83
|
-
var userApi = new UserApi(
|
85
|
+
var userApi = new UserApi(_serverUrl);
|
84
86
|
|
85
87
|
var user = await userApi.PostUserAsync(provisional);
|
86
88
|
|