This commit is contained in:
53
HanyadikHetVan/Controllers/V2/HanyadikHetVanController.cs
Normal file
53
HanyadikHetVan/Controllers/V2/HanyadikHetVanController.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using HanyadikHetVan.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HanyadikHetVan.Controllers.V2
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersion("2.0")]
|
||||
[Route("api/v{version:apiVersion}/[controller]")]
|
||||
public class HanyadikHetVanController : Controller
|
||||
{
|
||||
private readonly HanyadikHetVanEntityService _hanyadikHetVanEntityService;
|
||||
|
||||
public HanyadikHetVanController(HanyadikHetVanEntityService hanyadikHetVanEntityService)
|
||||
{
|
||||
_hanyadikHetVanEntityService = hanyadikHetVanEntityService ?? throw new ArgumentNullException(nameof(hanyadikHetVanEntityService));
|
||||
}
|
||||
|
||||
[HttpGet("{weeklytimespanId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(int))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetWeekById(int weeklytimespanId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var wts = await _hanyadikHetVanEntityService.GetWeekById(weeklytimespanId);
|
||||
return Ok(wts);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(int))]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> GetDefaultWeek()
|
||||
{
|
||||
try
|
||||
{
|
||||
var wts = await _hanyadikHetVanEntityService.GetDefaultWeek();
|
||||
return Ok(wts);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user