hrms-api-backend/BMA.EHR.MetaData.Service/Controllers/PositionExecutiveController.cs

62 lines
2.2 KiB
C#
Raw Permalink Normal View History

2024-12-24 05:14:31 +07:00
using BMA.EHR.Domain.Common;
using BMA.EHR.MetaData.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.MetaData.Service.Controllers
{
[Route("api/v{version:apiVersion}/metadata/position-executive")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลประเภทตำแหน่ง เพื่อนำไปใช้งานในระบบ")]
public class PositionExecutiveController : BaseController
{
#region " Fields "
private readonly PositionExecutiveService _positionExecutiveService;
#endregion
#region " Constructor and Destructor "
public PositionExecutiveController(PositionExecutiveService positionExecutiveService)
{
_positionExecutiveService = positionExecutiveService;
}
#endregion
#region " Methods "
/// <summary>
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync()
{
try
{
var items = await _positionExecutiveService.GetsAsync(showAll: false);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}