|
|
@ -1,8 +1,10 @@
|
|
|
|
using API.Dto;
|
|
|
|
using API.Dto;
|
|
|
|
|
|
|
|
using API.Mapping;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Model;
|
|
|
|
using Model;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using StubLib;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
using System.Net.Http.Headers;
|
|
|
@ -17,15 +19,30 @@ namespace API.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly ILogger<ChampionController> _logger;
|
|
|
|
private readonly ILogger<ChampionController> _logger;
|
|
|
|
private readonly HttpClient _client;
|
|
|
|
private readonly HttpClient _client;
|
|
|
|
private const string Apichampion = "api/champion";
|
|
|
|
|
|
|
|
private readonly IDataManager dataManager;
|
|
|
|
private readonly IDataManager dataManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private const string Apichampion = "api/champion";
|
|
|
|
|
|
|
|
|
|
|
|
public ChampionController(IDataManager datamanager, ILogger<ChampionController> logger)
|
|
|
|
public ChampionController(IDataManager datamanager, ILogger<ChampionController> logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
this.dataManager = datamanager;
|
|
|
|
this.dataManager = datamanager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
public async Task<ActionResult<ChampionDto>> Get()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
StubData stub = new StubData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<Champion?> listeChamp = await stub.ChampionsMgr.GetItems(0, stub.ChampionsMgr.GetNbItems().Result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ChampionDto> champs = new List<ChampionDto>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listeChamp.ToList().ForEach(c => champs.Add(c.ToDto()));
|
|
|
|
|
|
|
|
return Ok(champs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Route("{id}")]
|
|
|
|
[Route("{id}")]
|
|
|
|
public ActionResult<IEnumerable<ChampionDto>> GetById()
|
|
|
|
public ActionResult<IEnumerable<ChampionDto>> GetById()
|
|
|
|