This commit is contained in:
parent
c461f0461d
commit
017f7a2e7b
27
Controller/HanyadikHetVanService.cs
Normal file
27
Controller/HanyadikHetVanService.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 HanyadikHetVanService
|
||||||
|
{
|
||||||
|
private readonly ILogger<HanyadikHetVanService> _logger;
|
||||||
|
private IConfiguration _configuration;
|
||||||
|
|
||||||
|
public HanyadikHetVanService(ILogger<HanyadikHetVanService> logger, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
_configuration = configuration;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HanyadikHetVanDTO HanyadikHetVan()
|
||||||
|
{
|
||||||
|
return new HanyadikHetVanDTO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using hanyadikhetvan.DTO;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -11,17 +12,18 @@ namespace hanyadikhetvan.Controllers
|
|||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class HanyadikHetVanController : ControllerBase
|
public class HanyadikHetVanController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILogger<HanyadikHetVanController> _logger;
|
|
||||||
|
|
||||||
public HanyadikHetVanController(ILogger<HanyadikHetVanController> logger)
|
private readonly HanyadikHetVanService _service;
|
||||||
|
|
||||||
|
public HanyadikHetVanController(HanyadikHetVanService service)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public HanyadikHetVan Get()
|
public HanyadikHetVanDTO Get()
|
||||||
{
|
{
|
||||||
return new HanyadikHetVan();
|
return _service.HanyadikHetVan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace hanyadikhetvan
|
namespace hanyadikhetvan.DTO
|
||||||
{
|
{
|
||||||
public class HanyadikHetVan
|
public class HanyadikHetVanDTO
|
||||||
{
|
{
|
||||||
public int HanyadikHet => (DateTime.Now - (DateTime.Parse(Environment.GetEnvironmentVariable("HANYADIKHET_STARTDATE")))).Days / 7;
|
public int HanyadikHet => (DateTime.Now - (DateTime.Parse(Environment.GetEnvironmentVariable("HANYADIKHET_STARTDATE")))).Days / 7;
|
||||||
}
|
}
|
@ -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.AddTransient<HanyadikHetVanService>();
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user