diff --git a/Sources/ConsoleApplication/Utils.cs b/Sources/ConsoleApplication/Utils.cs index fec49ea..6d9e315 100644 --- a/Sources/ConsoleApplication/Utils.cs +++ b/Sources/ConsoleApplication/Utils.cs @@ -36,7 +36,8 @@ namespace ConsoleApplication switch (choix) { case "1": - Console.WriteLine("# result : "+ await championsManager.GetNbItems()); + var json = await championsManager.GetNbItems(); + Console.WriteLine("# result : "+ json); break; case "2": var list = await championsManager.GetItems(0, 10); diff --git a/Sources/HttpClient/ChampionCountResponse.cs b/Sources/HttpClient/ChampionCountResponse.cs new file mode 100644 index 0000000..7f523e9 --- /dev/null +++ b/Sources/HttpClient/ChampionCountResponse.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HttpClient +{ + public class ChampionCountResponse + { + public int Result { get; set; } + public int Id { get; set; } + public object Exception { get; set; } + public int Status { get; set; } + public bool IsCanceled { get; set; } + public bool IsCompleted { get; set; } + public bool IsCompletedSuccessfully { get; set; } + public int CreationOptions { get; set; } + public object AsyncState { get; set; } + public bool IsFaulted { get; set; } + } + +} diff --git a/Sources/HttpClient/HttpClientManager.Champion.cs b/Sources/HttpClient/HttpClientManager.Champion.cs index 5eed5c0..672931c 100644 --- a/Sources/HttpClient/HttpClientManager.Champion.cs +++ b/Sources/HttpClient/HttpClientManager.Champion.cs @@ -74,9 +74,14 @@ namespace HttpClient return httpc.GetFromJsonAsync>("v1/Champions?name=" + substring+"&index=" + index + "&size=" + count); } - public Task GetNbItems() - { - return httpc.GetFromJsonAsync("v1/Champions/count"); + public async Task GetNbItems() + { + //HttpResponseMessage response = + //Console.WriteLine(response.Content.ToString()); + //return int.Parse(response.Content.ToString()); + //return await httpc.GetFromJsonAsync("v1/Champions/count"); + var response = await httpc.GetFromJsonAsync("v1/Champions/count"); + return response.Result; }