Add a cache system on the referential info

+ Add an identity service
This commit is contained in:
Sébastien André
2021-04-17 22:17:45 +02:00
parent 0bb9ed2a30
commit 143127cd01
30 changed files with 955 additions and 570 deletions

View File

@@ -1,34 +1,39 @@
using System;
using System.Collections.Generic;
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Domain;
using System;
using System.Collections.Generic;
namespace skydiveLogs_api.DomainBusiness
{
public class JumpService : IJumpService
{
#region Public Constructors
public JumpService(IJumpTypeService jumpTypeService,
IAircraftService aircraftService,
IDropZoneService dropZoneService,
IGearService gearService,
IJumpRepository jumpRepository)
IJumpRepository jumpRepository,
IIdentityService identityService)
{
_jumpTypeService = jumpTypeService;
_aircraftService = aircraftService;
_dropZoneService = dropZoneService;
_gearService = gearService;
_jumpRepository = jumpRepository;
_identityService = identityService;
}
#endregion Public Constructors
#region Public Methods
public void AddNewJump(int aircraftId,
int dzId,
int jumpTypeId,
int gearId,
Jump jump,
User connectedUser)
Jump jump)
{
var selectedGear = _gearService.GetGearById(gearId);
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
@@ -39,7 +44,7 @@ namespace skydiveLogs_api.DomainBusiness
jump.JumpType = selectedJumpType;
jump.DropZone = selectedDropZone;
jump.Gear = selectedGear;
jump.User = connectedUser;
jump.User = _identityService.ConnectedUser;
_jumpRepository.Add(jump);
}
@@ -49,9 +54,9 @@ namespace skydiveLogs_api.DomainBusiness
throw new NotImplementedException();
}
public IEnumerable<Jump> GetAllJumps(User connectedUser)
public IEnumerable<Jump> GetAllJumps()
{
return _jumpRepository.GetAll(connectedUser);
return _jumpRepository.GetAll(_identityService.ConnectedUser);
}
public Jump GetJumpById(int id)
@@ -64,14 +69,17 @@ namespace skydiveLogs_api.DomainBusiness
throw new NotImplementedException();
}
private readonly IJumpRepository _jumpRepository;
#endregion Public Methods
private readonly IJumpTypeService _jumpTypeService;
#region Private Fields
private readonly IAircraftService _aircraftService;
private readonly IDropZoneService _dropZoneService;
private readonly IGearService _gearService;
private readonly IIdentityService _identityService;
private readonly IJumpRepository _jumpRepository;
private readonly IJumpTypeService _jumpTypeService;
#endregion Private Fields
}
}
}