|
|
|
@ -31,16 +31,17 @@ namespace apiLOL.Controllers
|
|
|
|
|
//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
|
|
|
|
|
_logger.LogInformation($"methode Get de ControllerChampions appelée");
|
|
|
|
|
_logger.LogInformation($"Nombre de champions : {await data.ChampionsMgr.GetNbItems()}");
|
|
|
|
|
|
|
|
|
|
var champs = (await data.ChampionsMgr.GetItems(0, await data.ChampionsMgr.GetNbItems())).Select(Model => Model.ToDTO());
|
|
|
|
|
int nbChampions = await data.ChampionsMgr.GetNbItems();
|
|
|
|
|
_logger.LogInformation($"Nombre de champions : {nbChampions}");
|
|
|
|
|
|
|
|
|
|
var champs = (await data.ChampionsMgr.GetItems(index, count)).Select(Model => Model.ToDTO());
|
|
|
|
|
|
|
|
|
|
var page = new ChampionPageDTO
|
|
|
|
|
{
|
|
|
|
|
Data = champs,
|
|
|
|
|
Index = index,
|
|
|
|
|
Count = count,
|
|
|
|
|
TotalCount = 100
|
|
|
|
|
TotalCount = nbChampions
|
|
|
|
|
};
|
|
|
|
|
return Ok(page);
|
|
|
|
|
}
|
|
|
|
@ -71,10 +72,13 @@ namespace apiLOL.Controllers
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PUT api/<ControllerLol>/5
|
|
|
|
|
[HttpPut("{id}")]
|
|
|
|
|
[HttpPut("{name}")]
|
|
|
|
|
[MapToApiVersion("1.0")]
|
|
|
|
|
public void Put(int id, [FromBody] string value)
|
|
|
|
|
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
|
|
|
|
|