You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
using Microsoft.AspNetCore.Mvc;
|
|
using Model;
|
|
using StubLib;
|
|
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
namespace apiLOL.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class ControllerChampions : Controller
|
|
{
|
|
private readonly IDataManager data;
|
|
//public StubData.ChampionsManager ChampionsManager { get; set; }
|
|
|
|
public ControllerChampions(IDataManager manager)
|
|
{
|
|
|
|
data = manager;
|
|
}
|
|
|
|
|
|
// GET: api/<ControllerLol>
|
|
[HttpGet]
|
|
public async Task<IActionResult> Get()
|
|
{
|
|
var champs = (await data.ChampionsMgr.GetItems(0, await data.ChampionsMgr.GetNbItems())).Select(Model => Model.ToDTO());
|
|
return Ok(champs);
|
|
}
|
|
|
|
|
|
// GET api/<ControllerLol>/5
|
|
[HttpGet("{id}")]
|
|
public async Task<IActionResult> Get(int id)
|
|
{
|
|
//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);
|
|
|
|
}
|
|
|
|
// POST api/<ControllerLol>
|
|
[HttpPost]
|
|
public void Post([FromBody] string value)
|
|
{
|
|
}
|
|
|
|
// PUT api/<ControllerLol>/5
|
|
[HttpPut("{id}")]
|
|
public void Put(int id, [FromBody] string value)
|
|
{
|
|
}
|
|
|
|
// DELETE api/<ControllerLol>/5
|
|
[HttpDelete("{id}")]
|
|
public void Delete(int id)
|
|
{
|
|
}
|
|
}
|
|
}
|