add content type routing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2ab8648a71
commit
5d49b1fc39
27
Controller/HanyadikHetVanJsonService.cs
Normal file
27
Controller/HanyadikHetVanJsonService.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using hanyadikhetvan.DTO;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace hanyadikhetvan
|
||||||
|
{
|
||||||
|
public class HanyadikHetVanJsonService
|
||||||
|
{
|
||||||
|
private readonly ILogger<HanyadikHetVanJsonService> _logger;
|
||||||
|
private IConfiguration _configuration;
|
||||||
|
|
||||||
|
public HanyadikHetVanJsonService(ILogger<HanyadikHetVanJsonService> logger, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_configuration = configuration;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HanyadikHetVanDTO HanyadikHetVan()
|
||||||
|
{
|
||||||
|
return new HanyadikHetVanDTO(_configuration["HanyadikHetVan:StartDate"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,9 +19,9 @@ namespace hanyadikhetvan
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HanyadikHetVanDTO HanyadikHetVan()
|
public int HanyadikHetVan()
|
||||||
{
|
{
|
||||||
return new HanyadikHetVanDTO(_configuration["HanyadikHetVan:StartDate"]);
|
return new HanyadikHetVanDTO(_configuration["HanyadikHetVan:StartDate"]).HanyadikHet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,19 +9,29 @@ using System.Threading.Tasks;
|
|||||||
namespace hanyadikhetvan.Controllers
|
namespace hanyadikhetvan.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("/")]
|
||||||
public class HanyadikHetVanController : ControllerBase
|
public class HanyadikHetVanController : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly HanyadikHetVanJsonService _jsonservice;
|
||||||
private readonly HanyadikHetVanService _service;
|
private readonly HanyadikHetVanService _service;
|
||||||
|
|
||||||
public HanyadikHetVanController(HanyadikHetVanService service)
|
|
||||||
|
public HanyadikHetVanController(HanyadikHetVanJsonService jsonservice, HanyadikHetVanService service)
|
||||||
{
|
{
|
||||||
|
_jsonservice = jsonservice;
|
||||||
_service = service;
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public HanyadikHetVanDTO Get()
|
[Consumes("application/json")]
|
||||||
|
public HanyadikHetVanDTO GetJson()
|
||||||
|
{
|
||||||
|
return _jsonservice.HanyadikHetVan();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public int Get()
|
||||||
{
|
{
|
||||||
return _service.HanyadikHetVan();
|
return _service.HanyadikHetVan();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace hanyadikhetvan
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// services.Configure<HanyadikHetVanService>(Configuration.GetSection("HanyadikHetVan"));
|
services.AddTransient<HanyadikHetVanJsonService>();
|
||||||
services.AddTransient<HanyadikHetVanService>();
|
services.AddTransient<HanyadikHetVanService>();
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user