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)
{
_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>
@ -69,8 +69,8 @@ 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);
}
catch (Exception e)
@ -126,7 +126,7 @@ namespace API_LoL_Project.Controllers
_logger.LogWarning("No chamions found with {name}", name); ;
return NotFound();
}
return Ok(res.LargeImage);
}
@ -142,11 +142,11 @@ namespace API_LoL_Project.Controllers
[HttpGet("{name}")]
public async Task<ActionResult<LolResponce<ChampionFullDTO>>> GetChampionsByName(string name)
{
_logger.LogInformation("Executing {Action} with name : {championName}", nameof(GetChampionsByName), name);
_logger.LogInformation("Executing {Action} with name : {championName}", nameof(GetChampionsByName), name);
try
{
var totalcount = await dataManager.GetNbItemsByName(name);
if ( totalcount <= 0)
if (totalcount <= 0)
{
_logger.LogWarning("No chamions found with this name {name}", name); ;
return BadRequest("No chamions found with this name: " + name);
@ -154,14 +154,14 @@ namespace API_LoL_Project.Controllers
var champion = await dataManager.GetItemsByName(name, 0, totalcount);
/* 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); ;
return NotFound("No chamions found with"+name);
return NotFound("No chamions found with" + name);
}
ChampionFullDTO res = champion.First().toFullDTO();//.First
var links = new List<EndPointLink>
{
EndPointLink.To($"/api/[controller]/{res.Name}", "self"),
@ -169,7 +169,7 @@ namespace API_LoL_Project.Controllers
EndPointLink.To($"/api/[controller]/{res.Name}/", "self")
};
var response = new LolResponce<ChampionFullDTO>(res,links);
var response = new LolResponce<ChampionFullDTO>(res, links);
return Ok(response);
}
@ -289,26 +289,26 @@ namespace API_LoL_Project.Controllers
return Ok(res);
}
/* [HttpGet("/{name}/skills")]
public async Task<ActionResult<SkillDto>> GetChampionsSkills(string name)
{
_logger.LogInformation("Executing {Action} with name : {championName}", nameof(GetChampionsSkills), name);
var champions = await dataManager.GetItemsByName(name, 0, await dataManager.GetNbItems());
if (champions == null)
{
_logger.LogWarning("No chamions found with {name}", name); ;
return NotFound();
}
//skinsDTO
IEnumerable<SkillDto> res = champions.First().Skills.to;
if (res == null)
{
_logger.LogWarning("No skins found for {name}", name); ;
return NotFound();
}
return Ok(res);
}*/
/* [HttpGet("/{name}/skills")]
public async Task<ActionResult<SkillDto>> GetChampionsSkills(string name)
{
_logger.LogInformation("Executing {Action} with name : {championName}", nameof(GetChampionsSkills), name);
var champions = await dataManager.GetItemsByName(name, 0, await dataManager.GetNbItems());
if (champions == null)
{
_logger.LogWarning("No chamions found with {name}", name); ;
return NotFound();
}
//skinsDTO
IEnumerable<SkillDto> res = champions.First().Skills.to;
if (res == null)
{
_logger.LogWarning("No skins found for {name}", name); ;
return NotFound();
}
return Ok(res);
}*/
[HttpPost("/{name}/skills")]
public async Task<ActionResult<IEnumerable<SkinDto>>> AddChampionsSkills(string name)
@ -320,15 +320,14 @@ namespace API_LoL_Project.Controllers
return Ok(res);
}
/*[HttpGet("/{name}/skins")]
public async Task<ActionResult<Skill> NbChampions()
// degradation du modèle cleitn ell est dédié au cliens
[HttpGet("/count")]
public async Task<ActionResult<int>> NbChampions()
{
var champions = await dataManager.GetItems(0, await dataManager.GetNbItems());
IEnumerable<ChampionDTO> res = champions.Select(c => c.toDTO());
return Ok(res);
var nbChampions = await dataManager.GetNbItems();
return Ok(nbChampions);
}
}*/
}
}

Loading…
Cancel
Save