Add some update
Add a TODO for the ideas
This commit is contained in:
@@ -11,6 +11,8 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces
|
||||
|
||||
Tunnel GetTunnelById(int id);
|
||||
|
||||
void AddNewFlight(int tunnelId, TunnelFlight newFlight);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,13 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
#region Public Constructors
|
||||
|
||||
public TunnelService(IDropZoneRepository dropZoneRepository,
|
||||
ITunnelFlightepository tunnelFlightRepository,
|
||||
IDropZoneService dropZoneService,
|
||||
ICacheService cacheService)
|
||||
{
|
||||
_dropZoneRepository = dropZoneRepository;
|
||||
_dropZoneService = dropZoneService;
|
||||
_tunnelFlightRepository = tunnelFlightRepository;
|
||||
_cacheService = cacheService;
|
||||
}
|
||||
|
||||
@@ -33,6 +37,28 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
return allTunnels.Single(g => g.Id == id);
|
||||
}
|
||||
|
||||
public void AddNewFlight(int tunnelId, TunnelFlight newFlight)
|
||||
{
|
||||
var selectedTunnel = _dropZoneService.GetDzById(tunnelId)
|
||||
.Single(t => new Tunnel
|
||||
{
|
||||
Id = t.Id,
|
||||
Name = t.Name,
|
||||
Website = t.Website,
|
||||
Address = t.Address,
|
||||
Email = t.Email,
|
||||
Latitude = t.Latitude,
|
||||
Longitude = t.Longitude
|
||||
}); ;
|
||||
|
||||
newFlight.Tunnel = selectedTunnel;
|
||||
_tunnelFlightRepository.Add(newFlight);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private IEnumerable<Tunnel> GetAllRefTunnels()
|
||||
{
|
||||
if (!_cacheService.Contains(CacheType.Tunnel))
|
||||
@@ -54,13 +80,14 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
|
||||
return _cacheService.Get<IEnumerable<Tunnel>>(CacheType.Tunnel);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
#endregion Private Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ICacheService _cacheService;
|
||||
private readonly IDropZoneService _dropZoneService;
|
||||
private readonly IDropZoneRepository _dropZoneRepository;
|
||||
private readonly ITunnelFlightepository _tunnelFlightRepository;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user