From 509ea3545e1208de028b54cf373d7b0c35f4190f Mon Sep 17 00:00:00 2001 From: Valentin Stoev Date: Thu, 13 Feb 2020 20:10:06 +0200 Subject: [PATCH] Add APIs (#74) * Add API * Refactoring * Add Services For APIs * Add Services with DI in API Controllers --- AJS.Services/Implementations/AdsApiService.cs | 15 +++++ AJS.Services/Implementations/AdsService.cs | 4 ++ .../Implementations/JobsApiService.cs | 15 +++++ AJS.Services/Implementations/JobsService.cs | 4 ++ .../Implementations/NewsApiService.cs | 15 +++++ AJS.Services/Implementations/NewsService.cs | 4 ++ .../Implementations/ServiceApiService.cs | 15 +++++ .../Implementations/ServicesService.cs | 4 ++ AJS.Services/Interfaces/IAdsApiService.cs | 10 ++++ AJS.Services/Interfaces/IJobsApiService.cs | 10 ++++ AJS.Services/Interfaces/INewsApiService.cs | 10 ++++ AJS.Services/Interfaces/IServiceApiService.cs | 10 ++++ AJS.Web/Areas/Api/AdsController.cs | 56 ++++++++++++++++++ AJS.Web/Areas/Api/JobsController.cs | 57 +++++++++++++++++++ AJS.Web/Areas/Api/NewsController.cs | 57 +++++++++++++++++++ AJS.Web/Areas/Api/ServicesController.cs | 57 +++++++++++++++++++ 16 files changed, 343 insertions(+) create mode 100644 AJS.Services/Implementations/AdsApiService.cs create mode 100644 AJS.Services/Implementations/JobsApiService.cs create mode 100644 AJS.Services/Implementations/NewsApiService.cs create mode 100644 AJS.Services/Implementations/ServiceApiService.cs create mode 100644 AJS.Services/Interfaces/IAdsApiService.cs create mode 100644 AJS.Services/Interfaces/IJobsApiService.cs create mode 100644 AJS.Services/Interfaces/INewsApiService.cs create mode 100644 AJS.Services/Interfaces/IServiceApiService.cs create mode 100644 AJS.Web/Areas/Api/AdsController.cs create mode 100644 AJS.Web/Areas/Api/JobsController.cs create mode 100644 AJS.Web/Areas/Api/NewsController.cs create mode 100644 AJS.Web/Areas/Api/ServicesController.cs diff --git a/AJS.Services/Implementations/AdsApiService.cs b/AJS.Services/Implementations/AdsApiService.cs new file mode 100644 index 0000000..48955db --- /dev/null +++ b/AJS.Services/Implementations/AdsApiService.cs @@ -0,0 +1,15 @@ +using AJS.Services.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Implementations +{ + class AdsApiService : IAdsApiService + { + public AdsApiService() + { + + } + } +} diff --git a/AJS.Services/Implementations/AdsService.cs b/AJS.Services/Implementations/AdsService.cs index ba64812..2f8b614 100644 --- a/AJS.Services/Implementations/AdsService.cs +++ b/AJS.Services/Implementations/AdsService.cs @@ -4,5 +4,9 @@ namespace AJS.Services.Implementations { public class AdsService : IAdsService { + public AdsService() + { + + } } } diff --git a/AJS.Services/Implementations/JobsApiService.cs b/AJS.Services/Implementations/JobsApiService.cs new file mode 100644 index 0000000..42725d3 --- /dev/null +++ b/AJS.Services/Implementations/JobsApiService.cs @@ -0,0 +1,15 @@ +using AJS.Services.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Implementations +{ + class JobsApiService :IJobsApiService + { + public JobsApiService() + { + + } + } +} diff --git a/AJS.Services/Implementations/JobsService.cs b/AJS.Services/Implementations/JobsService.cs index f8c27fb..fa060b2 100644 --- a/AJS.Services/Implementations/JobsService.cs +++ b/AJS.Services/Implementations/JobsService.cs @@ -4,5 +4,9 @@ namespace AJS.Services.Implementations { public class JobsService : IJobsService { + public JobsService() + { + + } } } diff --git a/AJS.Services/Implementations/NewsApiService.cs b/AJS.Services/Implementations/NewsApiService.cs new file mode 100644 index 0000000..471afab --- /dev/null +++ b/AJS.Services/Implementations/NewsApiService.cs @@ -0,0 +1,15 @@ +using AJS.Services.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Implementations +{ + class NewsApiService : INewsApiService + { + public NewsApiService() + { + + } + } +} diff --git a/AJS.Services/Implementations/NewsService.cs b/AJS.Services/Implementations/NewsService.cs index cc8ade6..ac2ae78 100644 --- a/AJS.Services/Implementations/NewsService.cs +++ b/AJS.Services/Implementations/NewsService.cs @@ -4,5 +4,9 @@ namespace AJS.Services.Implementations { public class NewsService : INewsService { + public NewsService() + { + + } } } diff --git a/AJS.Services/Implementations/ServiceApiService.cs b/AJS.Services/Implementations/ServiceApiService.cs new file mode 100644 index 0000000..0db31c4 --- /dev/null +++ b/AJS.Services/Implementations/ServiceApiService.cs @@ -0,0 +1,15 @@ +using AJS.Services.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Implementations +{ + class ServiceApiService : IServiceApiService + { + public ServiceApiService() + { + + } + } +} diff --git a/AJS.Services/Implementations/ServicesService.cs b/AJS.Services/Implementations/ServicesService.cs index 0116794..3d1c889 100644 --- a/AJS.Services/Implementations/ServicesService.cs +++ b/AJS.Services/Implementations/ServicesService.cs @@ -4,5 +4,9 @@ namespace AJS.Services.Implementations { public class ServicesService : IServicesService { + public ServicesService() + { + + } } } diff --git a/AJS.Services/Interfaces/IAdsApiService.cs b/AJS.Services/Interfaces/IAdsApiService.cs new file mode 100644 index 0000000..86c0304 --- /dev/null +++ b/AJS.Services/Interfaces/IAdsApiService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Interfaces +{ + public interface IAdsApiService + { + } +} diff --git a/AJS.Services/Interfaces/IJobsApiService.cs b/AJS.Services/Interfaces/IJobsApiService.cs new file mode 100644 index 0000000..3d5626e --- /dev/null +++ b/AJS.Services/Interfaces/IJobsApiService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Interfaces +{ + public interface IJobsApiService + { + } +} diff --git a/AJS.Services/Interfaces/INewsApiService.cs b/AJS.Services/Interfaces/INewsApiService.cs new file mode 100644 index 0000000..cb7772c --- /dev/null +++ b/AJS.Services/Interfaces/INewsApiService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Interfaces +{ + public interface INewsApiService + { + } +} diff --git a/AJS.Services/Interfaces/IServiceApiService.cs b/AJS.Services/Interfaces/IServiceApiService.cs new file mode 100644 index 0000000..bbb1805 --- /dev/null +++ b/AJS.Services/Interfaces/IServiceApiService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AJS.Services.Interfaces +{ + public interface IServiceApiService + { + } +} diff --git a/AJS.Web/Areas/Api/AdsController.cs b/AJS.Web/Areas/Api/AdsController.cs new file mode 100644 index 0000000..50f64b9 --- /dev/null +++ b/AJS.Web/Areas/Api/AdsController.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AJS.Services.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AJS.Web.Areas.Api +{ + [Route("api/Ads")] + [ApiController] + public class AdsController : ControllerBase + { + private readonly IAdsApiService adsApiService; + + public AdsController(IAdsApiService adsApiService) + { + this.adsApiService = adsApiService; + } + [HttpGet] + [Route("Get")] + public IActionResult Get() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetById")] + public IActionResult GetById() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByCategory")] + public IActionResult GetByCategory() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByDate")] + public IActionResult GetByDate() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByLastDateSync")] + public IActionResult GetByLastDateSync() + { + return new JsonResult("Implement me"); + } + } +} \ No newline at end of file diff --git a/AJS.Web/Areas/Api/JobsController.cs b/AJS.Web/Areas/Api/JobsController.cs new file mode 100644 index 0000000..520d74b --- /dev/null +++ b/AJS.Web/Areas/Api/JobsController.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AJS.Services.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AJS.Web.Areas.Api +{ + [Route("api/Jobs")] + [ApiController] + public class JobsController : ControllerBase + { + private readonly IJobsApiService jobsApiService; + + public JobsController(IJobsApiService jobsApiService) + { + this.jobsApiService = jobsApiService; + } + + [HttpGet] + [Route("Get")] + public IActionResult Get() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetById")] + public IActionResult GetById() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByCategory")] + public IActionResult GetByCategory() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByDate")] + public IActionResult GetByDate() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByLastDateSync")] + public IActionResult GetByLastDateSync() + { + return new JsonResult("Implement me"); + } + } +} \ No newline at end of file diff --git a/AJS.Web/Areas/Api/NewsController.cs b/AJS.Web/Areas/Api/NewsController.cs new file mode 100644 index 0000000..dacae34 --- /dev/null +++ b/AJS.Web/Areas/Api/NewsController.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AJS.Services.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AJS.Web.Areas.Api +{ + [Route("api/News")] + [ApiController] + public class NewsController : ControllerBase + { + private readonly INewsApiService newsApiService; + + public NewsController(INewsApiService newsApiService) + { + this.newsApiService = newsApiService; + } + + [HttpGet] + [Route("Get")] + public IActionResult Get() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetById")] + public IActionResult GetById() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByCategory")] + public IActionResult GetByCategory() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByDate")] + public IActionResult GetByDate() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByLastDateSync")] + public IActionResult GetByLastDateSync() + { + return new JsonResult("Implement me"); + } + } +} \ No newline at end of file diff --git a/AJS.Web/Areas/Api/ServicesController.cs b/AJS.Web/Areas/Api/ServicesController.cs new file mode 100644 index 0000000..899c47f --- /dev/null +++ b/AJS.Web/Areas/Api/ServicesController.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AJS.Services.Interfaces; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AJS.Web.Areas.Api +{ + [Route("api/Services")] + [ApiController] + public class ServicesController : ControllerBase + { + private readonly IServiceApiService servicesApiService; + + public ServicesController(IServiceApiService servicesApiService) + { + this.servicesApiService = servicesApiService; + } + + [HttpGet] + [Route("Get")] + public IActionResult Get() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetById")] + public IActionResult GetById() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByCategory")] + public IActionResult GetByCategory() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByDate")] + public IActionResult GetByDate() + { + return new JsonResult("Implement me"); + } + + [HttpGet] + [Route("GetByLastDateSync")] + public IActionResult GetByLastDateSync() + { + return new JsonResult("Implement me"); + } + } +} \ No newline at end of file