api cms แก้หน้าสมัครสอบ
This commit is contained in:
parent
c986fc1500
commit
9486ad160d
21 changed files with 9389 additions and 0 deletions
232
Controllers/CMSCandidateController.cs
Normal file
232
Controllers/CMSCandidateController.cs
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
using BMA.EHR.Recurit.Exam.Service.Core;
|
||||
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||
using BMA.EHR.Recurit.Exam.Service.Request;
|
||||
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}/cms")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลหน้าเว็บสมัครสอบ เพื่อนำไปใช้งานในระบบ")]
|
||||
public class CMSCandidateController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly CMSCandidateService _cmsCandidateService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public CMSCandidateController(CMSCandidateService cmsCandidateService)
|
||||
{
|
||||
_cmsCandidateService = cmsCandidateService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// แสดงข้อมูลรายละเอียดหน้าเว็บสมัครสอบ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านแสดงข้อมูลรายละเอียดหน้าเว็บสมัครสอบสำเร็จ</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 _cmsCandidateService.GetsAsync();
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล รายละเอียดหน้าเว็บ ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="detail">รายละเอียดหน้าเว็บ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล รายละเอียดหน้าเว็บ ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("detail")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDetailAsync(RequestCMSAbout detail)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _cmsCandidateService.UpdateDetailAsync(detail);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล ข้อมูลเกี่ยวกับเรา ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="about">ข้อมูลเกี่ยวกับเรา</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลเกี่ยวกับเรา ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("about")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateAboutAsync(RequestCMSAbout about)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _cmsCandidateService.UpdateAboutAsync(about);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล โลโก้เว็บไซย์ ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="logo">โลโก้เว็บไซย์</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล โลโก้เว็บไซย์ ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("logo"), DisableRequestSizeLimit]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateLogoAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
|
||||
var file = Request.Form.Files[0];
|
||||
await _cmsCandidateService.UpdateLogoAsync(file);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล Banner ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="banner">Banner</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล Banner ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("banner"), DisableRequestSizeLimit]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateBannerAsync(CMSCandidate banner)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
|
||||
var file = Request.Form.Files[0];
|
||||
await _cmsCandidateService.UpdateBannerAsync(file);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล Agency ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="agency">Agency</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล Agency ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("agency")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateAgencyAsync(List<RequestCMSAgency> agency)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _cmsCandidateService.UpdateAgencyAsync(agency);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพเดทข้อมูล Government ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="government">Government</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอัพเดทข้อมูล Government ผู้สมัคร สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("government")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateGovernmentAsync(List<RequestCMSGovernment> government)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _cmsCandidateService.UpdateGovernmentAsync(government);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue