|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Model;
|
|
|
|
|
using StubLib;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using static StubLib.StubData;
|
|
|
|
|
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
|
|
|
|
|
|
namespace apiLOL.Controllers
|
|
|
|
@ -10,7 +12,6 @@ namespace apiLOL.Controllers
|
|
|
|
|
public class ControllerChampions : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly IDataManager data;
|
|
|
|
|
//public StubData.ChampionsManager ChampionsManager { get; set; }
|
|
|
|
|
|
|
|
|
|
public ControllerChampions(IDataManager manager)
|
|
|
|
|
{
|
|
|
|
@ -29,22 +30,20 @@ namespace apiLOL.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GET api/<ControllerLol>/5
|
|
|
|
|
[HttpGet("{id}")]
|
|
|
|
|
public async Task<IActionResult> Get(int id)
|
|
|
|
|
[HttpGet("{name}")]
|
|
|
|
|
public async Task<IActionResult> Get(string name)
|
|
|
|
|
{
|
|
|
|
|
//ChampionsManager.GetNbItemsByCharacteristic("Akali");
|
|
|
|
|
//ChampionMapper.ToDTO(ChampionsManager.GetNbItemsByCharacteristic("Akali"));
|
|
|
|
|
//return new ChampionMapper.ToDTO(ChampionsManager.GetNbItemsByCharacteristic("Akali"));
|
|
|
|
|
//return "value";
|
|
|
|
|
var champs = (await data.ChampionsMgr.GetItems(0, await data.ChampionsMgr.GetNbItems())).Select(Model => Model.ToDTO());
|
|
|
|
|
return Ok(champs);
|
|
|
|
|
|
|
|
|
|
var champ = await data.ChampionsMgr.GetItemsByName(name, 0, await data.ChampionsMgr.GetNbItemsByName(name));
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// POST api/<ControllerLol>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Post([FromBody] string value)
|
|
|
|
|
public IActionResult Post(ChampionDTO champDTO)
|
|
|
|
|
{
|
|
|
|
|
Champion tmp = champDTO.ToModel();
|
|
|
|
|
data.ChampionsMgr.AddItem(tmp);
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PUT api/<ControllerLol>/5
|
|
|
|
@ -58,5 +57,6 @@ namespace apiLOL.Controllers
|
|
|
|
|
public void Delete(int id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|