diff --git a/Sources/apiLOL/ChampionPageDTO.cs b/Sources/apiLOL/ChampionPageDTO.cs new file mode 100644 index 0000000..5fff791 --- /dev/null +++ b/Sources/apiLOL/ChampionPageDTO.cs @@ -0,0 +1,13 @@ +namespace apiLOL +{ + public class ChampionPageDTO + { + public IEnumerable Data { get; set; } + + public int Index { get; set; } + + public int Count { get; set; } + + public int TotalCount { get; set; } + } +} diff --git a/Sources/apiLOL/Controllers/ControllerChampions.cs b/Sources/apiLOL/Controllers/ControllerChampions.cs index 7bc619f..5e1a255 100644 --- a/Sources/apiLOL/Controllers/ControllerChampions.cs +++ b/Sources/apiLOL/Controllers/ControllerChampions.cs @@ -24,13 +24,22 @@ namespace apiLOL.Controllers // GET: api/ [HttpGet] - public async Task Get([FromQuery] string name = "") + public async Task Get([FromQuery] int index = 0, int count = 10, string name = "") { //FromQuery permet de filtrer dans la collection de champions en fonction du nom _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()); - return Ok(champs); + + var page = new ChampionPageDTO + { + Data = champs, + Index = index, + Count = count, + TotalCount = 100 + }; + return Ok(page); }