|
|
|
@ -24,7 +24,7 @@ namespace apiLOL.Controllers
|
|
|
|
|
|
|
|
|
|
// GET: api/<ControllerLol>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<IActionResult> Get(int index = 0, int count = 10)
|
|
|
|
|
public async Task<IActionResult> Get([FromQuery]int index = 0, int count = 10, string nom="")
|
|
|
|
|
{
|
|
|
|
|
//FromQuery permet de filtrer dans la collection de champions en fonction du nom
|
|
|
|
|
// Possible de faire une classe PageRequest pour gérer les paramètres index et count
|
|
|
|
@ -32,7 +32,6 @@ namespace apiLOL.Controllers
|
|
|
|
|
int nbChampions = await data.ChampionsMgr.GetNbItems();
|
|
|
|
|
_logger.LogInformation($"Nombre de champions : {nbChampions}");
|
|
|
|
|
|
|
|
|
|
//var champs = (await data.ChampionsMgr.GetItems(0, await data.ChampionsMgr.GetNbItems())).Select(Model => Model.ToDTO());
|
|
|
|
|
var champs = (await data.ChampionsMgr.GetItems(index, count)).Select(Model => Model.ToDTO());
|
|
|
|
|
|
|
|
|
|
var page = new ChampionPageDTO
|
|
|
|
@ -69,9 +68,12 @@ namespace apiLOL.Controllers
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PUT api/<ControllerLol>/5
|
|
|
|
|
[HttpPut("{id}")]
|
|
|
|
|
public void Put(int id, [FromBody] string value)
|
|
|
|
|
[HttpPut("{name}")]
|
|
|
|
|
public async Task<IActionResult> Put( string name, string bio)
|
|
|
|
|
{
|
|
|
|
|
var champs = (await data.ChampionsMgr.GetItemsByName(name, 0, 1)).First();
|
|
|
|
|
champs.Bio = bio;
|
|
|
|
|
return Ok(champs.ToDTO());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DELETE api/<ControllerLol>/5
|
|
|
|
|