onions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-02-09 16:28:13 +01:00
parent c461f0461d
commit 017f7a2e7b
4 changed files with 38 additions and 9 deletions

View 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();
}
}
}

View File

@ -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();
} }
} }
} }

View File

@ -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;
} }

View File

@ -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();
} }