count endpoints
continuous-integration/drone/push Build is failing Details

David_next_step
David D'ALMEIDA 2 years ago
parent d416ae2183
commit 9bc670215e

@ -52,7 +52,7 @@ namespace API_LoL_Project.Controllers
if (res.Count() <= 0 || res == null) if (res.Count() <= 0 || res == null)
{ {
_logger.LogError("No chamions found the total count is {totalcount} ", totalcount); _logger.LogError("No chamions found the total count is {totalcount} ", totalcount);
return BadRequest("No chamions found : totalcount is : "+ totalcount); return BadRequest("No chamions found : totalcount is : " + totalcount);
} }
var respList = res.Select(r => new LolResponce<ChampionDTO> var respList = res.Select(r => new LolResponce<ChampionDTO>
@ -69,7 +69,7 @@ namespace API_LoL_Project.Controllers
} }
)); ));
var pageResponse = new PageResponse<ChampionDTO>(respList,request.index,request.count,totalcount); var pageResponse = new PageResponse<ChampionDTO>(respList, request.index, request.count, totalcount);
return Ok(pageResponse); return Ok(pageResponse);
} }
@ -146,7 +146,7 @@ namespace API_LoL_Project.Controllers
try try
{ {
var totalcount = await dataManager.GetNbItemsByName(name); var totalcount = await dataManager.GetNbItemsByName(name);
if ( totalcount <= 0) if (totalcount <= 0)
{ {
_logger.LogWarning("No chamions found with this name {name}", name); ; _logger.LogWarning("No chamions found with this name {name}", name); ;
return BadRequest("No chamions found with this name: " + name); return BadRequest("No chamions found with this name: " + name);
@ -154,10 +154,10 @@ namespace API_LoL_Project.Controllers
var champion = await dataManager.GetItemsByName(name, 0, totalcount); var champion = await dataManager.GetItemsByName(name, 0, totalcount);
/* IEnumerable<ChampionFullDTO> res = champion.Select(c => c.toFullDTO());//.First*/ /* IEnumerable<ChampionFullDTO> res = champion.Select(c => c.toFullDTO());//.First*/
if (champion.Count() <= 0 || champion == null ) if (champion.Count() <= 0 || champion == null)
{ {
_logger.LogWarning("No chamions found with {name}", name); ; _logger.LogWarning("No chamions found with {name}", name); ;
return NotFound("No chamions found with"+name); return NotFound("No chamions found with" + name);
} }
ChampionFullDTO res = champion.First().toFullDTO();//.First ChampionFullDTO res = champion.First().toFullDTO();//.First
@ -169,7 +169,7 @@ namespace API_LoL_Project.Controllers
EndPointLink.To($"/api/[controller]/{res.Name}/", "self") EndPointLink.To($"/api/[controller]/{res.Name}/", "self")
}; };
var response = new LolResponce<ChampionFullDTO>(res,links); var response = new LolResponce<ChampionFullDTO>(res, links);
return Ok(response); return Ok(response);
} }
@ -320,15 +320,14 @@ namespace API_LoL_Project.Controllers
return Ok(res); return Ok(res);
} }
/*[HttpGet("/{name}/skins")] // degradation du modèle cleitn ell est dédié au cliens
public async Task<ActionResult<Skill> NbChampions() [HttpGet("/count")]
public async Task<ActionResult<int>> NbChampions()
{ {
var champions = await dataManager.GetItems(0, await dataManager.GetNbItems()); var nbChampions = await dataManager.GetNbItems();
IEnumerable<ChampionDTO> res = champions.Select(c => c.toDTO()); return Ok(nbChampions);
return Ok(res);
}*/
} }
}
} }

Loading…
Cancel
Save