correction du count, desormais fonctionnel en ligne de commande
continuous-integration/drone/push Build is failing Details

master
Pierre Ferreira 2 years ago
parent d38600ce4b
commit 28e5a0e570

@ -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);

@ -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; }
}
}

@ -74,9 +74,14 @@ namespace HttpClient
return httpc.GetFromJsonAsync<IEnumerable<Champion>>("v1/Champions?name=" + substring+"&index=" + index + "&size=" + count);
}
public Task<int> GetNbItems()
{
return httpc.GetFromJsonAsync<int>("v1/Champions/count");
public async Task<int> GetNbItems()
{
//HttpResponseMessage response =
//Console.WriteLine(response.Content.ToString());
//return int.Parse(response.Content.ToString());
//return await httpc.GetFromJsonAsync<int>("v1/Champions/count");
var response = await httpc.GetFromJsonAsync<ChampionCountResponse>("v1/Champions/count");
return response.Result;
}

Loading…
Cancel
Save