Update the repository pattern

This commit is contained in:
Sébastien André
2019-11-10 19:31:55 +01:00
parent 3f1d648fa9
commit b95eedbf7c
19 changed files with 112 additions and 73 deletions

View File

@@ -1,10 +1,11 @@
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.Model;
using System;
using System;
using System.Collections.Generic;
using System.Text;
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.Model;
using skydiveLogs_api.Data.Interface;
namespace skydiveLogs_api.Business
{
public class AircraftService : IAircraftService
@@ -26,12 +27,12 @@ namespace skydiveLogs_api.Business
public Aircraft GetAircraftById(int id)
{
return _aircraftRepository.GetAircraftById(id);
return _aircraftRepository.GetById(id);
}
public IEnumerable<Aircraft> GetAllAircrafts()
{
return _aircraftRepository.GetAllAircrafts();
return _aircraftRepository.GetAll();
}
public void UpdateAircraft(int id, Aircraft aircraft)

View File

@@ -27,12 +27,12 @@ namespace skydiveLogs_api.Business
public IEnumerable<DropZone> GetAllDzs()
{
return _dropZoneRepository.GetAllDzs();
return _dropZoneRepository.GetAll();
}
public DropZone GetDzById(int id)
{
return _dropZoneRepository.GetDzById(id);
return _dropZoneRepository.GetById(id);
}
public void UpdateDz(int id, DropZone dropZone)

View File

@@ -27,12 +27,12 @@ namespace skydiveLogs_api.Business
public IEnumerable<Jump> GetAllJumps()
{
return _jumpRepository.GetAllJumps();
return _jumpRepository.GetAll();
}
public Jump GetJumpById(int id)
{
return _jumpRepository.GetJumpById(id);
return _jumpRepository.GetById(id);
}
public void UpdateJump(int id, Jump jump)

View File

@@ -1,9 +1,11 @@
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.Model;
using System;
using System;
using System.Collections.Generic;
using skydiveLogs_api.Business.Interface;
using skydiveLogs_api.Model;
using skydiveLogs_api.Data.Interface;
namespace skydiveLogs_api.Business
{
public class JumpTypeService : IJumpTypeService
@@ -25,12 +27,12 @@ namespace skydiveLogs_api.Business
public IEnumerable<JumpType> GetAllJumpTypes()
{
return _jumpTypeRepository.GetAllJumpTypes();
return _jumpTypeRepository.GetAll();
}
public JumpType GetJumpTypeById(int id)
{
return _jumpTypeRepository.GetJumpTypeById(id);
return _jumpTypeRepository.GetById(id);
}
public void UpdateJumpType(int id, JumpType value)

View File

@@ -17,7 +17,7 @@ namespace skydiveLogs_api.Business
public IEnumerable<Statistic> GetStatsByAircraft()
{
var allJumps = _jumpRepository.GetAllJumps();
var allJumps = _jumpRepository.GetAll();
return allJumps.GroupBy(j => j.AircraftId,
j => j,
@@ -31,7 +31,7 @@ namespace skydiveLogs_api.Business
public IEnumerable<Statistic> GetStatsByDz()
{
var allJumps = _jumpRepository.GetAllJumps();
var allJumps = _jumpRepository.GetAll();
return allJumps.GroupBy(j => j.DropZoneId,
j => j,
@@ -45,7 +45,7 @@ namespace skydiveLogs_api.Business
public IEnumerable<Statistic> GetStatsByJumpType()
{
var allJumps = _jumpRepository.GetAllJumps();
var allJumps = _jumpRepository.GetAll();
return allJumps.GroupBy(j => j.JumpTypeId,
j => j,
@@ -59,7 +59,7 @@ namespace skydiveLogs_api.Business
public IEnumerable<Statistic> GetStatsByRig()
{
var allJumps = _jumpRepository.GetAllJumps();
var allJumps = _jumpRepository.GetAll();
return allJumps.GroupBy(j => j.GearId,
j => j,
@@ -73,7 +73,7 @@ namespace skydiveLogs_api.Business
public IEnumerable<Statistic> GetStatsByYear()
{
var allJumps = _jumpRepository.GetAllJumps();
var allJumps = _jumpRepository.GetAll();
return allJumps.GroupBy(j => j.JumpDate.Year,
j => j,