Rename directories and projects
This commit is contained in:
77
Back/skydiveLogs-api.DomainBusiness/JumpService.cs
Normal file
77
Back/skydiveLogs-api.DomainBusiness/JumpService.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using skydiveLogs_api.DomainService.Repositories;
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
|
||||
namespace skydiveLogs_api.DomainBusiness
|
||||
{
|
||||
public class JumpService : IJumpService
|
||||
{
|
||||
public JumpService(IJumpTypeService jumpTypeService,
|
||||
IAircraftService aircraftService,
|
||||
IDropZoneService dropZoneService,
|
||||
IGearService gearService,
|
||||
IJumpRepository jumpRepository)
|
||||
{
|
||||
_jumpTypeService = jumpTypeService;
|
||||
_aircraftService = aircraftService;
|
||||
_dropZoneService = dropZoneService;
|
||||
_gearService = gearService;
|
||||
_jumpRepository = jumpRepository;
|
||||
}
|
||||
|
||||
public void AddNewJump(int aircraftId,
|
||||
int dzId,
|
||||
int jumpTypeId,
|
||||
int gearId,
|
||||
Jump jump,
|
||||
User connectedUser)
|
||||
{
|
||||
var selectedGear = _gearService.GetGearById(gearId);
|
||||
var selectedJumpType = _jumpTypeService.GetJumpTypeById(jumpTypeId);
|
||||
var selectedAircraft = _aircraftService.GetAircraftById(aircraftId);
|
||||
var selectedDropZone = _dropZoneService.GetDzById(dzId);
|
||||
|
||||
jump.Aircraft = selectedAircraft;
|
||||
jump.JumpType = selectedJumpType;
|
||||
jump.DropZone = selectedDropZone;
|
||||
jump.Gear = selectedGear;
|
||||
jump.User = connectedUser;
|
||||
|
||||
_jumpRepository.Add(jump);
|
||||
}
|
||||
|
||||
public void DeleteJumpById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Jump> GetAllJumps(User connectedUser)
|
||||
{
|
||||
return _jumpRepository.GetAll(connectedUser);
|
||||
}
|
||||
|
||||
public Jump GetJumpById(int id)
|
||||
{
|
||||
return _jumpRepository.GetById(id);
|
||||
}
|
||||
|
||||
public void UpdateJump(int id, Jump jump)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private readonly IJumpRepository _jumpRepository;
|
||||
|
||||
private readonly IJumpTypeService _jumpTypeService;
|
||||
|
||||
private readonly IAircraftService _aircraftService;
|
||||
|
||||
private readonly IDropZoneService _dropZoneService;
|
||||
|
||||
private readonly IGearService _gearService;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user