Début liaison API -> EF :magic_wand:
continuous-integration/drone/push Build is failing Details

API2
nathan boileau 2 years ago
parent f3bf722d61
commit fb75fbb6be

@ -1,47 +0,0 @@
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)
{
}
}
}

@ -3,14 +3,16 @@
public class ChampionDTO
{
public ChampionDTO(string name, string bio)
{
public ChampionDTO(string name, string bio, string icon)
{
Name = name;
Bio = bio;
}
Icon = icon;
}
public string Name { get; set; }
public string Bio { get; set; }
public string Icon { get; set; }
}
}

@ -4,14 +4,15 @@ 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, champion.Icon);
public static Champion ToModel(this ChampionDTO championDTO)
{
Champion champ = new Champion(championDTO.Name);
champ.Bio = championDTO.Bio;
return champ;
champ.Icon = championDTO.Icon;
return champ;
}
}

@ -0,0 +1,20 @@
using EFLol;
using Model;
namespace apiLOL
{
public class EFDataManager : IDataManager
{
// Connect to the MyDbContext class
private readonly MyDbContext _context;
// Constructor
public EFDataManager(MyDbContext context)
{
_context = context;
}
// Implement the interface
}
}

@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EFLol\EFLol.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\StubLib\StubLib.csproj" />
</ItemGroup>

Loading…
Cancel
Save