organisation projet

API2
nathan boileau 2 years ago
parent e2a3c3e463
commit 2dbe282b7b

@ -1,13 +0,0 @@
namespace apiLOL
{
public class ChampionPageDTO
{
public IEnumerable<ChampionDTO> Data { get; set; }
public int Index { get; set; }
public int Count { get; set; }
public int TotalCount { get; set; }
}
}

@ -1,11 +1,12 @@
using System.Security.Cryptography;
using apiLOL.DTO;
using Microsoft.AspNetCore.Mvc;
using Model;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace apiLOL.Controllers
{
[ApiController]
[ApiController]
[Route("api/v1/[controller]")]
[ApiVersion("1.0")]

@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace apiLOL.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ApiVersion("1.0")]
public class ControllerSkin : ControllerBase
{
// GET: api/<ControllerSkin>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<ControllerSkin>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<ControllerSkin>
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/<ControllerSkin>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<ControllerSkin>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

@ -1,4 +1,4 @@
namespace apiLOL
namespace apiLOL.DTO
{
public class ChampionDTO
{

@ -1,10 +1,10 @@
using Model;
namespace apiLOL
namespace apiLOL.DTO
{
public static class ChampionMapper
{
public static ChampionDTO ToDTO(this Champion champion) => new ChampionDTO(champion.Name, champion.Bio);
public static ChampionDTO ToDTO(this Champion champion) => new ChampionDTO(champion.Name, champion.Bio);
public static Champion ToModel(this ChampionDTO championDTO)
@ -14,5 +14,5 @@ namespace apiLOL
return champ;
}
}
}
}

@ -0,0 +1,13 @@
namespace apiLOL.DTO
{
public class ChampionPageDTO
{
public IEnumerable<ChampionDTO> Data { get; set; }
public int Index { get; set; }
public int Count { get; set; }
public int TotalCount { get; set; }
}
}
Loading…
Cancel
Save