From 5d476e5e4e42ad61233dcf36c6afc84b9583d0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Andr=C3=A9?= Date: Fri, 20 Sep 2019 19:29:54 +0200 Subject: [PATCH] Add drafts for Interface business and repository + DataContract presentation --- .../Interface/IAircraftService.cs | 10 ++++++++++ .../Interface/IDropZoneService.cs | 10 ++++++++++ .../Interface/IJumpService.cs | 10 ++++++++++ .../Interface/IJumpTypeService.cs | 10 ++++++++++ .../skydiveLogs-api.Business.csproj | 4 ---- .../DropZoneRepository.cs | 3 ++- Back/skydiveLogs-api.Data/GearRepository.cs | 3 ++- .../Interface/IDropZoneRepository.cs | 10 ++++++++++ .../Interface/IGearRepository.cs | 10 ++++++++++ .../Interface/IJumpRepository.cs | 10 ++++++++++ .../Interface/IJumpTypeRepository.cs | 10 ++++++++++ Back/skydiveLogs-api.Data/JumpRepository.cs | 3 ++- .../JumpTypeRepository.cs | 3 ++- .../Controllers/AircraftController.cs | 9 +++++++++ .../Controllers/DropZoneController.cs | 8 ++++++++ .../Controllers/JumpController.cs | 9 +++++++++ .../Controllers/JumpTypeController.cs | 9 +++++++++ .../DataContract/AircraftReq.cs | 11 +++++++++++ .../DataContract/AircraftResp.cs | 11 +++++++++++ Back/skydiveLogs-api/DataContract/JumpReq.cs | 11 +++++++++++ Back/skydiveLogs-api/DataContract/JumpResp.cs | 11 +++++++++++ .../DataContract/JumpTypeReq.cs | 11 +++++++++++ .../DataContract/JumpTypeResp.cs | 11 +++++++++++ Back/skydiveLogs-api/Program.cs | 12 ++---------- Back/skydiveLogs-api/Startup.cs | 19 +++++++++++-------- 25 files changed, 202 insertions(+), 26 deletions(-) create mode 100644 Back/skydiveLogs-api.Business/Interface/IAircraftService.cs create mode 100644 Back/skydiveLogs-api.Business/Interface/IDropZoneService.cs create mode 100644 Back/skydiveLogs-api.Business/Interface/IJumpService.cs create mode 100644 Back/skydiveLogs-api.Business/Interface/IJumpTypeService.cs create mode 100644 Back/skydiveLogs-api.Data/Interface/IDropZoneRepository.cs create mode 100644 Back/skydiveLogs-api.Data/Interface/IGearRepository.cs create mode 100644 Back/skydiveLogs-api.Data/Interface/IJumpRepository.cs create mode 100644 Back/skydiveLogs-api.Data/Interface/IJumpTypeRepository.cs create mode 100644 Back/skydiveLogs-api/DataContract/AircraftReq.cs create mode 100644 Back/skydiveLogs-api/DataContract/AircraftResp.cs create mode 100644 Back/skydiveLogs-api/DataContract/JumpReq.cs create mode 100644 Back/skydiveLogs-api/DataContract/JumpResp.cs create mode 100644 Back/skydiveLogs-api/DataContract/JumpTypeReq.cs create mode 100644 Back/skydiveLogs-api/DataContract/JumpTypeResp.cs diff --git a/Back/skydiveLogs-api.Business/Interface/IAircraftService.cs b/Back/skydiveLogs-api.Business/Interface/IAircraftService.cs new file mode 100644 index 0000000..e039cae --- /dev/null +++ b/Back/skydiveLogs-api.Business/Interface/IAircraftService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Business.Interface +{ + public interface IAircraftService + { + } +} diff --git a/Back/skydiveLogs-api.Business/Interface/IDropZoneService.cs b/Back/skydiveLogs-api.Business/Interface/IDropZoneService.cs new file mode 100644 index 0000000..25323bc --- /dev/null +++ b/Back/skydiveLogs-api.Business/Interface/IDropZoneService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Business.Interface +{ + public interface IDropZoneService + { + } +} diff --git a/Back/skydiveLogs-api.Business/Interface/IJumpService.cs b/Back/skydiveLogs-api.Business/Interface/IJumpService.cs new file mode 100644 index 0000000..9e30fe3 --- /dev/null +++ b/Back/skydiveLogs-api.Business/Interface/IJumpService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Business.Interface +{ + public interface IJumpService + { + } +} diff --git a/Back/skydiveLogs-api.Business/Interface/IJumpTypeService.cs b/Back/skydiveLogs-api.Business/Interface/IJumpTypeService.cs new file mode 100644 index 0000000..8b2326c --- /dev/null +++ b/Back/skydiveLogs-api.Business/Interface/IJumpTypeService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Business.Interface +{ + public interface IJumpTypeService + { + } +} diff --git a/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj b/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj index 8479c11..4e1543c 100644 --- a/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj +++ b/Back/skydiveLogs-api.Business/skydiveLogs-api.Business.csproj @@ -5,10 +5,6 @@ skydiveLogs_api.Business - - - - diff --git a/Back/skydiveLogs-api.Data/DropZoneRepository.cs b/Back/skydiveLogs-api.Data/DropZoneRepository.cs index ba98754..da01a9a 100644 --- a/Back/skydiveLogs-api.Data/DropZoneRepository.cs +++ b/Back/skydiveLogs-api.Data/DropZoneRepository.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Text; +using skydiveLogs_api.Data.Interface; namespace skydiveLogs_api.Data { - class DropZoneRepository + public class DropZoneRepository : IDropZoneRepository { } } diff --git a/Back/skydiveLogs-api.Data/GearRepository.cs b/Back/skydiveLogs-api.Data/GearRepository.cs index 3bccd4f..280ac3e 100644 --- a/Back/skydiveLogs-api.Data/GearRepository.cs +++ b/Back/skydiveLogs-api.Data/GearRepository.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Text; +using skydiveLogs_api.Data.Interface; namespace skydiveLogs_api.Data { - class GearRepository + public class GearRepository : IGearRepository { } } diff --git a/Back/skydiveLogs-api.Data/Interface/IDropZoneRepository.cs b/Back/skydiveLogs-api.Data/Interface/IDropZoneRepository.cs new file mode 100644 index 0000000..f1dee6c --- /dev/null +++ b/Back/skydiveLogs-api.Data/Interface/IDropZoneRepository.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Data.Interface +{ + public interface IDropZoneRepository + { + } +} diff --git a/Back/skydiveLogs-api.Data/Interface/IGearRepository.cs b/Back/skydiveLogs-api.Data/Interface/IGearRepository.cs new file mode 100644 index 0000000..9821582 --- /dev/null +++ b/Back/skydiveLogs-api.Data/Interface/IGearRepository.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Data.Interface +{ + public interface IGearRepository + { + } +} diff --git a/Back/skydiveLogs-api.Data/Interface/IJumpRepository.cs b/Back/skydiveLogs-api.Data/Interface/IJumpRepository.cs new file mode 100644 index 0000000..c47d120 --- /dev/null +++ b/Back/skydiveLogs-api.Data/Interface/IJumpRepository.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Data.Interface +{ + public interface IJumpRepository + { + } +} diff --git a/Back/skydiveLogs-api.Data/Interface/IJumpTypeRepository.cs b/Back/skydiveLogs-api.Data/Interface/IJumpTypeRepository.cs new file mode 100644 index 0000000..22ee076 --- /dev/null +++ b/Back/skydiveLogs-api.Data/Interface/IJumpTypeRepository.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace skydiveLogs_api.Data.Interface +{ + public interface IJumpTypeRepository + { + } +} diff --git a/Back/skydiveLogs-api.Data/JumpRepository.cs b/Back/skydiveLogs-api.Data/JumpRepository.cs index 45b2d69..1d4d740 100644 --- a/Back/skydiveLogs-api.Data/JumpRepository.cs +++ b/Back/skydiveLogs-api.Data/JumpRepository.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Text; +using skydiveLogs_api.Data.Interface; namespace skydiveLogs_api.Data { - class JumpRepository + public class JumpRepository : IJumpRepository { } } diff --git a/Back/skydiveLogs-api.Data/JumpTypeRepository.cs b/Back/skydiveLogs-api.Data/JumpTypeRepository.cs index e20ec05..3c2c2fb 100644 --- a/Back/skydiveLogs-api.Data/JumpTypeRepository.cs +++ b/Back/skydiveLogs-api.Data/JumpTypeRepository.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Text; +using skydiveLogs_api.Data.Interface; namespace skydiveLogs_api.Data { - class JumpTypeRepository + public class JumpTypeRepository : IJumpTypeRepository { } } diff --git a/Back/skydiveLogs-api/Controllers/AircraftController.cs b/Back/skydiveLogs-api/Controllers/AircraftController.cs index 65bc5ca..86cdf0a 100644 --- a/Back/skydiveLogs-api/Controllers/AircraftController.cs +++ b/Back/skydiveLogs-api/Controllers/AircraftController.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using skydiveLogs_api.Business.Interface; +using skydiveLogs_api.DataContract; namespace skydiveLogs_api.Controllers { @@ -11,6 +13,11 @@ namespace skydiveLogs_api.Controllers [ApiController] public class AircraftController : ControllerBase { + public AircraftController(IAircraftService aircraftService) + { + _aircraftService = aircraftService; + } + // GET: api/Aircraft [HttpGet] public IEnumerable Get() @@ -42,5 +49,7 @@ namespace skydiveLogs_api.Controllers public void Delete(int id) { } + + private readonly IAircraftService _aircraftService; } } diff --git a/Back/skydiveLogs-api/Controllers/DropZoneController.cs b/Back/skydiveLogs-api/Controllers/DropZoneController.cs index 67f4460..055432c 100644 --- a/Back/skydiveLogs-api/Controllers/DropZoneController.cs +++ b/Back/skydiveLogs-api/Controllers/DropZoneController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using skydiveLogs_api.Business.Interface; using skydiveLogs_api.DataContract; namespace skydiveLogs_api.Controllers @@ -12,6 +13,11 @@ namespace skydiveLogs_api.Controllers [ApiController] public class DropZoneController : ControllerBase { + public DropZoneController(IDropZoneService dropZoneService) + { + _dropZoneService = dropZoneService; + } + // GET: api/DropZone [HttpGet] public IEnumerable Get() @@ -43,5 +49,7 @@ namespace skydiveLogs_api.Controllers public void Delete(int id) { } + + private readonly IDropZoneService _dropZoneService; } } diff --git a/Back/skydiveLogs-api/Controllers/JumpController.cs b/Back/skydiveLogs-api/Controllers/JumpController.cs index f2847ab..4f0686b 100644 --- a/Back/skydiveLogs-api/Controllers/JumpController.cs +++ b/Back/skydiveLogs-api/Controllers/JumpController.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using skydiveLogs_api.Business.Interface; +using skydiveLogs_api.DataContract; namespace skydiveLogs_api.Controllers { @@ -11,6 +13,11 @@ namespace skydiveLogs_api.Controllers [ApiController] public class JumpController : ControllerBase { + public JumpController(IJumpService jumpService) + { + _jumpService = jumpService; + } + // GET: api/Jump [HttpGet] public IEnumerable Get() @@ -42,5 +49,7 @@ namespace skydiveLogs_api.Controllers public void Delete(int id) { } + + private readonly IJumpService _jumpService; } } diff --git a/Back/skydiveLogs-api/Controllers/JumpTypeController.cs b/Back/skydiveLogs-api/Controllers/JumpTypeController.cs index 0fcca70..e0bb826 100644 --- a/Back/skydiveLogs-api/Controllers/JumpTypeController.cs +++ b/Back/skydiveLogs-api/Controllers/JumpTypeController.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using skydiveLogs_api.Business.Interface; +using skydiveLogs_api.DataContract; namespace skydiveLogs_api.Controllers { @@ -11,6 +13,11 @@ namespace skydiveLogs_api.Controllers [ApiController] public class JumpTypeController : ControllerBase { + public JumpTypeController(IJumpTypeService jumpTypeService) + { + _jumpTypeService = jumpTypeService; + } + // GET: api/JumpType [HttpGet] public IEnumerable Get() @@ -42,5 +49,7 @@ namespace skydiveLogs_api.Controllers public void Delete(int id) { } + + private readonly IJumpTypeService _jumpTypeService; } } diff --git a/Back/skydiveLogs-api/DataContract/AircraftReq.cs b/Back/skydiveLogs-api/DataContract/AircraftReq.cs new file mode 100644 index 0000000..f205214 --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/AircraftReq.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class AircraftReq + { + } +} diff --git a/Back/skydiveLogs-api/DataContract/AircraftResp.cs b/Back/skydiveLogs-api/DataContract/AircraftResp.cs new file mode 100644 index 0000000..b0b4b3b --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/AircraftResp.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class AircraftResp + { + } +} diff --git a/Back/skydiveLogs-api/DataContract/JumpReq.cs b/Back/skydiveLogs-api/DataContract/JumpReq.cs new file mode 100644 index 0000000..63da3b8 --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/JumpReq.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class JumpReq + { + } +} diff --git a/Back/skydiveLogs-api/DataContract/JumpResp.cs b/Back/skydiveLogs-api/DataContract/JumpResp.cs new file mode 100644 index 0000000..ed2f730 --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/JumpResp.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class JumpResp + { + } +} diff --git a/Back/skydiveLogs-api/DataContract/JumpTypeReq.cs b/Back/skydiveLogs-api/DataContract/JumpTypeReq.cs new file mode 100644 index 0000000..3533915 --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/JumpTypeReq.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class JumpTypeReq + { + } +} diff --git a/Back/skydiveLogs-api/DataContract/JumpTypeResp.cs b/Back/skydiveLogs-api/DataContract/JumpTypeResp.cs new file mode 100644 index 0000000..68b4f34 --- /dev/null +++ b/Back/skydiveLogs-api/DataContract/JumpTypeResp.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace skydiveLogs_api.DataContract +{ + public class JumpTypeResp + { + } +} diff --git a/Back/skydiveLogs-api/Program.cs b/Back/skydiveLogs-api/Program.cs index c256952..54e7382 100644 --- a/Back/skydiveLogs-api/Program.cs +++ b/Back/skydiveLogs-api/Program.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; namespace skydiveLogs_api { @@ -18,7 +11,6 @@ namespace skydiveLogs_api } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); + WebHost.CreateDefaultBuilder(args).UseStartup(); } } diff --git a/Back/skydiveLogs-api/Startup.cs b/Back/skydiveLogs-api/Startup.cs index b27a628..d395621 100644 --- a/Back/skydiveLogs-api/Startup.cs +++ b/Back/skydiveLogs-api/Startup.cs @@ -1,15 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; namespace skydiveLogs_api { @@ -26,6 +19,16 @@ namespace skydiveLogs_api public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + + // IoC + //services.AddSingleton(Configuration); + //services.AddSingleton(); + //services.AddSingleton(); + //services.AddSingleton(); + + //services.AddScoped(); + //services.AddScoped(); + //services.AddScoped(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.