create project
This commit is contained in:
commit
ffeab6a127
196 changed files with 36968 additions and 0 deletions
63
Controllers/DistrictController.cs
Normal file
63
Controllers/DistrictController.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||
using BMA.EHR.Recurit.Exam.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/district")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลอำเภอ เพื่อนำไปใช้งานในระบบ")]
|
||||
public class DistrictController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly DistrictService _districtService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public DistrictController(DistrictService districtService)
|
||||
{
|
||||
_districtService = districtService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <param name="province">รหัสจังหวัด</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{province:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync(string province)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _districtService.GetsAsync(provinceId: province, showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue