Add methods used for the graph of the tunnel flights

This commit is contained in:
Sébastien ANDRE
2023-08-16 17:38:50 +02:00
parent 25e403c21f
commit dc06f256b4
5 changed files with 83 additions and 29 deletions

View File

@@ -23,14 +23,6 @@ namespace skydiveLogs_api.Controllers
#region Public Methods
// DELETE: api/Tunnel/5
//[HttpDelete("{id}")]
//[EnableCors]
//public void Delete(int id)
//{
// _tunnelService.DeleteTunnelById(id);
//}
// GET: api/TunnelFlight
[HttpGet]
[EnableCors]
@@ -58,6 +50,15 @@ namespace skydiveLogs_api.Controllers
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
}
// GET: api/TunnelFlight/month/20230101/20230701
[HttpGet("month/{beginDate}/{endDate}")]
[EnableCors]
public IEnumerable<StatisticResp> GetGroupByMonth(string beginDate, string endDate)
{
var result = _tunnelFlightService.GetTunnelFlightGroupByMonth(beginDate, endDate);
return _mapper.Map<IEnumerable<StatisticResp>>(result);
}
// POST: api/Tunnel
[HttpPost]
[EnableCors]
@@ -67,13 +68,21 @@ namespace skydiveLogs_api.Controllers
_mapper.Map<TunnelFlight>(value));
}
// PUT: api/Tunnel/5
//[HttpPut("{id}")]
//[EnableCors]
//public void Put(int id, [FromBody] TunnelReq value)
//{
// _tunnelService.UpdateJumpType(id, _mapper.Map<Tunnel>(value));
//}
// PUT: api/TunnelFlight/5
[HttpPut("{id}")]
[EnableCors]
public void Put(int id, [FromBody] TunnelFlightReq value)
{
_tunnelFlightService.UpdateTunnelFlight(id, _mapper.Map<TunnelFlight>(value));
}
// DELETE: api/TunnelFlight/5
[HttpDelete("{id}")]
[EnableCors]
public void Delete(int id)
{
_tunnelFlightService.DeleteTunnelFlightById(id);
}
#endregion Public Methods