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.
32 lines
725 B
32 lines
725 B
using Dto.Classe;
|
|
using Dto.Factories;
|
|
using Interface;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Modele.Classe;
|
|
|
|
namespace Api.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class Sessions : Controller
|
|
{
|
|
private readonly IApi data;
|
|
|
|
public Sessions(IApi manager)
|
|
{
|
|
this.data = manager;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> Get(string pseudo)
|
|
{
|
|
IEnumerable<Session> sessions = (await data.GetSessionsByPilotes(pseudo));
|
|
if (sessions == null)
|
|
{
|
|
return NotFound(pseudo);
|
|
}
|
|
return Ok(sessions.Select(e => e.ModeleToDTO()));
|
|
}
|
|
}
|
|
}
|