Add the feature to update a jum type
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
{
|
{
|
||||||
Gear,
|
Gear,
|
||||||
JumpType,
|
JumpType,
|
||||||
TunnelJumpType,
|
|
||||||
Aircraft,
|
Aircraft,
|
||||||
DropZone,
|
DropZone,
|
||||||
Tunnel
|
Tunnel
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces
|
|||||||
|
|
||||||
JumpType GetJumpTypeById(int id);
|
JumpType GetJumpTypeById(int id);
|
||||||
|
|
||||||
void UpdateJumpType(int id, JumpType value);
|
bool UpdateJumpType(int id, JumpType value);
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using skydiveLogs_api.Domain;
|
using skydiveLogs_api.Domain;
|
||||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||||
using skydiveLogs_api.DomainService.Repositories;
|
using skydiveLogs_api.DomainService.Repositories;
|
||||||
|
using skydiveLogs_api.Infrastructure;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -45,13 +46,7 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
|
|
||||||
public IEnumerable<JumpType> GetJumpTypesForTunnel()
|
public IEnumerable<JumpType> GetJumpTypesForTunnel()
|
||||||
{
|
{
|
||||||
if (!_cacheService.Contains(CacheType.JumpType))
|
return GetAllJumpTypes().Where(t => t.InTunnel);
|
||||||
{
|
|
||||||
var tmp = _jumpTypeRepository.GetAll().Where(t => t.InTunnel);
|
|
||||||
_cacheService.Put(CacheType.TunnelJumpType, tmp, 5 * 60 * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
return _cacheService.Get<IEnumerable<JumpType>>(CacheType.TunnelJumpType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JumpType GetJumpTypeById(int id)
|
public JumpType GetJumpTypeById(int id)
|
||||||
@@ -60,9 +55,15 @@ namespace skydiveLogs_api.DomainBusiness
|
|||||||
return allJumpTypes.Single(g => g.Id == id);
|
return allJumpTypes.Single(g => g.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateJumpType(int id, JumpType value)
|
public bool UpdateJumpType(int id, JumpType jumpType)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
jumpType.Id = id;
|
||||||
|
|
||||||
|
var result = _jumpTypeRepository.Update(jumpType);
|
||||||
|
if (result)
|
||||||
|
_cacheService.Delete(CacheType.JumpType);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Public Methods
|
#endregion Public Methods
|
||||||
|
|||||||
Reference in New Issue
Block a user