Différencier Tunnel et TunnelFlight
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -23,14 +22,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/Tunnel
|
||||
[HttpGet]
|
||||
[EnableCors]
|
||||
@@ -49,23 +40,6 @@ namespace skydiveLogs_api.Controllers
|
||||
return _mapper.Map<TunnelResp>(result);
|
||||
}
|
||||
|
||||
// POST: api/Tunnel
|
||||
[HttpPost]
|
||||
[EnableCors]
|
||||
public void Post([FromBody] TunnelFlightReq value)
|
||||
{
|
||||
_tunnelService.AddNewFlight(value.TunnelId,
|
||||
_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));
|
||||
//}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
78
Back/skydiveLogs-api/Controllers/TunnelFlightController.cs
Normal file
78
Back/skydiveLogs-api/Controllers/TunnelFlightController.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
public class TunnelFlightController : Base
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public TunnelFlightController(ITunnelFlightService tunnelFlightService,
|
||||
IMapper mapper)
|
||||
{
|
||||
_tunnelFlightService = tunnelFlightService;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
// DELETE: api/Tunnel/5
|
||||
//[HttpDelete("{id}")]
|
||||
//[EnableCors]
|
||||
//public void Delete(int id)
|
||||
//{
|
||||
// _tunnelService.DeleteTunnelById(id);
|
||||
//}
|
||||
|
||||
// GET: api/TunnelFlight
|
||||
[HttpGet]
|
||||
[EnableCors]
|
||||
public IEnumerable<TunnelFlightResp> Get()
|
||||
{
|
||||
var result = _tunnelFlightService.GetAllTunnelFlights();
|
||||
return _mapper.Map<IEnumerable<TunnelFlightResp>>(result);
|
||||
}
|
||||
|
||||
// GET: api/TunnelFlight/5
|
||||
[HttpGet("{id}")]
|
||||
[EnableCors]
|
||||
public TunnelFlightResp Get(int id)
|
||||
{
|
||||
var result = _tunnelFlightService.GetTunnelFlightById(id);
|
||||
return _mapper.Map<TunnelFlightResp>(result);
|
||||
}
|
||||
|
||||
// POST: api/Tunnel
|
||||
[HttpPost]
|
||||
[EnableCors]
|
||||
public void Post([FromBody] TunnelFlightReq value)
|
||||
{
|
||||
_tunnelFlightService.AddNewFlight(value.TunnelId,
|
||||
_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));
|
||||
//}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ITunnelFlightService _tunnelFlightService;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,4 @@ namespace skydiveLogs_api.DataContract
|
||||
|
||||
public DateTime FlightDate { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api/DataContract/TunnelFlightResp.cs
Normal file
17
Back/skydiveLogs-api/DataContract/TunnelFlightResp.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
public class TunnelFlightResp
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int TunnelId { get; set; }
|
||||
|
||||
public int NbMinutes { get; set; }
|
||||
|
||||
public string Notes { get; set; }
|
||||
|
||||
public DateTime FlightDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ namespace skydiveLogs_api.Mapper
|
||||
CreateMap<User, DataContract.UserResp>();
|
||||
CreateMap<UserImage, DataContract.ImageResp>();
|
||||
CreateMap<Tunnel, DataContract.TunnelResp>();
|
||||
CreateMap<TunnelFlight, DataContract.TunnelFlightResp>();
|
||||
|
||||
CreateMap<SimpleSummary, DataContract.SimpleSummaryResp>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user