Add the jump type in the tunnel flight

This commit is contained in:
Sébastien ANDRE
2023-08-17 11:29:13 +02:00
parent 9237e14bcf
commit 01fa8b60d0
14 changed files with 100 additions and 66 deletions

View File

@@ -11,11 +11,13 @@ namespace skydiveLogs_api.DomainBusiness
{
#region Public Constructors
public TunnelFlightService(ITunnelFlightRepository tunnelFlightRepository,
public TunnelFlightService(IJumpTypeService jumpTypeService,
ITunnelFlightRepository tunnelFlightRepository,
IDropZoneService dropZoneService,
IIdentityService identityService)
{
_dropZoneService = dropZoneService;
_jumpTypeService = jumpTypeService;
_identityService = identityService;
_tunnelFlightRepository = tunnelFlightRepository;
}
@@ -73,8 +75,8 @@ namespace skydiveLogs_api.DomainBusiness
return _tunnelFlightRepository.GetBetweenDate(_identityService.ConnectedUser, convertedBeginDate, convertedEndDate);
}
public void AddNewFlight(int tunnelId, TunnelFlight newFlight)
public void AddNewFlight(int tunnelId, int jumpTypeId, TunnelFlight newFlight)
{
var tmp = _dropZoneService.GetDzById(tunnelId);
var selectedTunnel = new Tunnel
@@ -88,7 +90,11 @@ namespace skydiveLogs_api.DomainBusiness
Longitude = tmp.Longitude
};
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
newFlight.Tunnel = selectedTunnel;
newFlight.JumpType = selectedJumpType;
_tunnelFlightRepository.Add(newFlight);
}
@@ -112,6 +118,7 @@ namespace skydiveLogs_api.DomainBusiness
#region Private Fields
private readonly IDropZoneService _dropZoneService;
private readonly IJumpTypeService _jumpTypeService;
private readonly ITunnelFlightRepository _tunnelFlightRepository;
private readonly IIdentityService _identityService;