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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -46,5 +46,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
|
||||||
public DbSet<BankExam> BankExams { get; set; }
|
public DbSet<BankExam> BankExams { get; set; }
|
||||||
|
|
||||||
public DbSet<PeriodExamDocument> PeriodExamDocuments { get; set; }
|
public DbSet<PeriodExamDocument> PeriodExamDocuments { get; set; }
|
||||||
|
|
||||||
|
public DbSet<CMSCandidate> CMSCandidates { get; set; }
|
||||||
|
|
||||||
|
public DbSet<CMSAgency> CMSAgencys { get; set; }
|
||||||
|
|
||||||
|
public DbSet<CMSGovernment> CMSGovernments { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,243 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
||||||
b.ToTable("BankExams");
|
b.ToTable("BankExams");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSAgency", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<Guid>("CMSCandidateId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Link")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ลิงค์");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อลิงค์");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CMSCandidateId");
|
||||||
|
|
||||||
|
b.ToTable("CMSAgencys");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<string>("About")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อมูลเกี่ยวกับเรา");
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ที่อยู่");
|
||||||
|
|
||||||
|
b.Property<Guid?>("BannerImgId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อมูลเว็บโดยย่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("DistrictId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("LogoImgId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("NameEn")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อเว็บภาษาอังกฤษ");
|
||||||
|
|
||||||
|
b.Property<string>("NameTh")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อเว็บภาษาไทย");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ProvinceId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("SubDistrictId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Telephone")
|
||||||
|
.HasMaxLength(20)
|
||||||
|
.HasColumnType("varchar(20)")
|
||||||
|
.HasComment("โทรศัพท์");
|
||||||
|
|
||||||
|
b.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("varchar(10)")
|
||||||
|
.HasComment("รหัสไปรษณีย์");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BannerImgId");
|
||||||
|
|
||||||
|
b.HasIndex("DistrictId");
|
||||||
|
|
||||||
|
b.HasIndex("LogoImgId");
|
||||||
|
|
||||||
|
b.HasIndex("ProvinceId");
|
||||||
|
|
||||||
|
b.HasIndex("SubDistrictId");
|
||||||
|
|
||||||
|
b.ToTable("CMSCandidates");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSGovernment", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<Guid>("CMSCandidateId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Link")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ลิงค์");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อลิงค์");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CMSCandidateId");
|
||||||
|
|
||||||
|
b.ToTable("CMSGovernments");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -1450,6 +1687,61 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
||||||
b.Navigation("PeriodExam");
|
b.Navigation("PeriodExam");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSAgency", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", "CMSCandidate")
|
||||||
|
.WithMany("CMSAgencys")
|
||||||
|
.HasForeignKey("CMSCandidateId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CMSCandidate");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "BannerImg")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BannerImgId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("DistrictId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "LogoImg")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("LogoImgId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "Province")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProvinceId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "SubDistrict")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SubDistrictId");
|
||||||
|
|
||||||
|
b.Navigation("BannerImg");
|
||||||
|
|
||||||
|
b.Navigation("District");
|
||||||
|
|
||||||
|
b.Navigation("LogoImg");
|
||||||
|
|
||||||
|
b.Navigation("Province");
|
||||||
|
|
||||||
|
b.Navigation("SubDistrict");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSGovernment", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", "CMSCandidate")
|
||||||
|
.WithMany("CMSGovernments")
|
||||||
|
.HasForeignKey("CMSCandidateId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CMSCandidate");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
|
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
|
||||||
|
|
@ -1654,6 +1946,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
||||||
b.Navigation("District");
|
b.Navigation("District");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.CMSCandidate", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("CMSAgencys");
|
||||||
|
|
||||||
|
b.Navigation("CMSGovernments");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
|
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("SubDistricts");
|
b.Navigation("SubDistricts");
|
||||||
|
|
|
||||||
1823
Migrations/20230407084011_Add table cms.Designer.cs
generated
Normal file
1823
Migrations/20230407084011_Add table cms.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
113
Migrations/20230407084011_Add table cms.cs
Normal file
113
Migrations/20230407084011_Add table cms.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Addtablecms : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CMSCandidates",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LogoImgId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
BannerImgId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
NameTh = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อเว็บภาษาไทย")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
NameEn = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อเว็บภาษาอังกฤษ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อมูลเว็บโดยย่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
About = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อมูลเกี่ยวกับเรา")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Address = table.Column<string>(type: "longtext", nullable: true, comment: "ที่อยู่")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
DistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
SubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
ZipCode = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true, comment: "รหัสไปรษณีย์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Telephone = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "โทรศัพท์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CMSCandidates", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSCandidates_Districts_DistrictId",
|
||||||
|
column: x => x.DistrictId,
|
||||||
|
principalTable: "Districts",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSCandidates_Documents_BannerImgId",
|
||||||
|
column: x => x.BannerImgId,
|
||||||
|
principalTable: "Documents",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSCandidates_Documents_LogoImgId",
|
||||||
|
column: x => x.LogoImgId,
|
||||||
|
principalTable: "Documents",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSCandidates_Provinces_ProvinceId",
|
||||||
|
column: x => x.ProvinceId,
|
||||||
|
principalTable: "Provinces",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSCandidates_SubDistricts_SubDistrictId",
|
||||||
|
column: x => x.SubDistrictId,
|
||||||
|
principalTable: "SubDistricts",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSCandidates_BannerImgId",
|
||||||
|
table: "CMSCandidates",
|
||||||
|
column: "BannerImgId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSCandidates_DistrictId",
|
||||||
|
table: "CMSCandidates",
|
||||||
|
column: "DistrictId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSCandidates_LogoImgId",
|
||||||
|
table: "CMSCandidates",
|
||||||
|
column: "LogoImgId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSCandidates_ProvinceId",
|
||||||
|
table: "CMSCandidates",
|
||||||
|
column: "ProvinceId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSCandidates_SubDistrictId",
|
||||||
|
table: "CMSCandidates",
|
||||||
|
column: "SubDistrictId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CMSCandidates");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2000
Migrations/20230407084734_Add table cms1.Designer.cs
generated
Normal file
2000
Migrations/20230407084734_Add table cms1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
123
Migrations/20230407084734_Add table cms1.cs
Normal file
123
Migrations/20230407084734_Add table cms1.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Addtablecms1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CMSAgency",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CandidateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
ZipCode = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อลิงค์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Telephone = table.Column<string>(type: "longtext", nullable: true, comment: "ลิงค์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CMSCandidateId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CMSAgency", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSAgency_CMSCandidates_CMSCandidateId",
|
||||||
|
column: x => x.CMSCandidateId,
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSAgency_Candidates_CandidateId",
|
||||||
|
column: x => x.CandidateId,
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "CMSGovernment",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CandidateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
ZipCode = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อลิงค์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Telephone = table.Column<string>(type: "longtext", nullable: true, comment: "ลิงค์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CMSCandidateId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_CMSGovernment", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSGovernment_CMSCandidates_CMSCandidateId",
|
||||||
|
column: x => x.CMSCandidateId,
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_CMSGovernment_Candidates_CandidateId",
|
||||||
|
column: x => x.CandidateId,
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSAgency_CandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
column: "CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSAgency_CMSCandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
column: "CMSCandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSGovernment_CandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
column: "CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSGovernment_CMSCandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
column: "CMSCandidateId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CMSAgency");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "CMSGovernment");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2000
Migrations/20230407090137_Add table agency.Designer.cs
generated
Normal file
2000
Migrations/20230407090137_Add table agency.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
242
Migrations/20230407090137_Add table agency.cs
Normal file
242
Migrations/20230407090137_Add table agency.cs
Normal file
|
|
@ -0,0 +1,242 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Addtableagency : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgency_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgency");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgency_Candidates_CandidateId",
|
||||||
|
table: "CMSAgency");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernment_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernment");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernment_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernment");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_CMSGovernment",
|
||||||
|
table: "CMSGovernment");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_CMSAgency",
|
||||||
|
table: "CMSAgency");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CMSGovernment",
|
||||||
|
newName: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CMSAgency",
|
||||||
|
newName: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ZipCode",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
newName: "Name");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Telephone",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
newName: "Link");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSGovernment_CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
newName: "IX_CMSGovernments_CMSCandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSGovernment_CandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
newName: "IX_CMSGovernments_CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ZipCode",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
newName: "Name");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Telephone",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
newName: "Link");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSAgency_CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
newName: "IX_CMSAgencys_CMSCandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSAgency_CandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
newName: "IX_CMSAgencys_CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_CMSGovernments",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_CMSAgencys",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgencys_Candidates_CandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernments_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgencys_Candidates_CandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernments_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_CMSGovernments",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_CMSAgencys",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CMSGovernments",
|
||||||
|
newName: "CMSGovernment");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "CMSAgencys",
|
||||||
|
newName: "CMSAgency");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Name",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
newName: "ZipCode");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Link",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
newName: "Telephone");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSGovernments_CMSCandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
newName: "IX_CMSGovernment_CMSCandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSGovernments_CandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
newName: "IX_CMSGovernment_CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Name",
|
||||||
|
table: "CMSAgency",
|
||||||
|
newName: "ZipCode");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Link",
|
||||||
|
table: "CMSAgency",
|
||||||
|
newName: "Telephone");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSAgencys_CMSCandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
newName: "IX_CMSAgency_CMSCandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_CMSAgencys_CandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
newName: "IX_CMSAgency_CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_CMSGovernment",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_CMSAgency",
|
||||||
|
table: "CMSAgency",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgency_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgency_Candidates_CandidateId",
|
||||||
|
table: "CMSAgency",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernment_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernment_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernment",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1982
Migrations/20230407090418_Add table goverment.Designer.cs
generated
Normal file
1982
Migrations/20230407090418_Add table goverment.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
175
Migrations/20230407090418_Add table goverment.cs
Normal file
175
Migrations/20230407090418_Add table goverment.cs
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Addtablegoverment : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgencys_Candidates_CandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernments_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_CMSGovernments_CandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_CMSAgencys_CandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)",
|
||||||
|
oldNullable: true)
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)",
|
||||||
|
oldNullable: true)
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)")
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "CandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)")
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "CandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSGovernments_CandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_CMSAgencys_CandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CandidateId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSAgencys_Candidates_CandidateId",
|
||||||
|
table: "CMSAgencys",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CMSCandidateId",
|
||||||
|
principalTable: "CMSCandidates",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_CMSGovernments_Candidates_CandidateId",
|
||||||
|
table: "CMSGovernments",
|
||||||
|
column: "CandidateId",
|
||||||
|
principalTable: "Candidates",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Models/CMSAgency.cs
Normal file
19
Models/CMSAgency.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
|
{
|
||||||
|
public class CMSAgency : EntityBase
|
||||||
|
{
|
||||||
|
[Required, Comment("Id CMS")]
|
||||||
|
public virtual CMSCandidate? CMSCandidate { get; set; }
|
||||||
|
|
||||||
|
[Comment("ชื่อลิงค์")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[Comment("ลิงค์")]
|
||||||
|
public string? Link { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
53
Models/CMSCandidate.cs
Normal file
53
Models/CMSCandidate.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
|
{
|
||||||
|
public class CMSCandidate : EntityBase
|
||||||
|
{
|
||||||
|
|
||||||
|
[Comment("Id โลโก้เว็บ")]
|
||||||
|
public virtual Document? LogoImg { get; set; }
|
||||||
|
|
||||||
|
[Comment("Id Banner")]
|
||||||
|
public virtual Document? BannerImg { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("ชื่อเว็บภาษาไทย")]
|
||||||
|
public string? NameTh { get; set; }
|
||||||
|
|
||||||
|
[Comment("ชื่อเว็บภาษาอังกฤษ")]
|
||||||
|
public string? NameEn { get; set; }
|
||||||
|
|
||||||
|
[Comment("ข้อมูลเว็บโดยย่อ")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("ข้อมูลเกี่ยวกับเรา")]
|
||||||
|
public string? About { get; set; }
|
||||||
|
|
||||||
|
[Comment("ที่อยู่")]
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
[Comment("จังหวัด")]
|
||||||
|
public virtual Province? Province { get; set; }
|
||||||
|
|
||||||
|
[Comment("อำเภอ")]
|
||||||
|
public virtual District? District { get; set; }
|
||||||
|
|
||||||
|
[Comment("ตำบล")]
|
||||||
|
public virtual SubDistrict? SubDistrict { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(10), Comment("รหัสไปรษณีย์")]
|
||||||
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(20), Comment("โทรศัพท์")]
|
||||||
|
public string? Telephone { get; set; }
|
||||||
|
|
||||||
|
public List<CMSAgency> CMSAgencys { get; set; } = new List<CMSAgency>();
|
||||||
|
|
||||||
|
public List<CMSGovernment> CMSGovernments { get; set; } = new List<CMSGovernment>();
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Models/CMSGovernment.cs
Normal file
19
Models/CMSGovernment.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
|
{
|
||||||
|
public class CMSGovernment : EntityBase
|
||||||
|
{
|
||||||
|
[Required, Comment("Id CMS")]
|
||||||
|
public virtual CMSCandidate? CMSCandidate { get; set; }
|
||||||
|
|
||||||
|
[Comment("ชื่อลิงค์")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[Comment("ลิงค์")]
|
||||||
|
public string? Link { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
{
|
{
|
||||||
[Required, Comment("Id ผู้สมัครสอบ")]
|
[Required, Comment("Id ผู้สมัครสอบ")]
|
||||||
public virtual Candidate? Candidate { get; set; }
|
public virtual Candidate? Candidate { get; set; }
|
||||||
|
|
||||||
[Required, Comment("Id ไฟล์เอกสาร")]
|
[Required, Comment("Id ไฟล์เอกสาร")]
|
||||||
public virtual Document? Document { get; set; }
|
public virtual Document? Document { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ builder.Services.AddTransient<SubDistrictService>();
|
||||||
builder.Services.AddTransient<CandidateService>();
|
builder.Services.AddTransient<CandidateService>();
|
||||||
builder.Services.AddTransient<PeriodExamService>();
|
builder.Services.AddTransient<PeriodExamService>();
|
||||||
builder.Services.AddTransient<MinIOService>();
|
builder.Services.AddTransient<MinIOService>();
|
||||||
|
builder.Services.AddTransient<CMSCandidateService>();
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllers(options =>
|
builder.Services.AddControllers(options =>
|
||||||
|
|
|
||||||
25
Request/RequestCMSAbout.cs
Normal file
25
Request/RequestCMSAbout.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||||
|
{
|
||||||
|
public class RequestCMSAbout
|
||||||
|
{
|
||||||
|
public string? BannerImg { get; set; }
|
||||||
|
// public Models.Document? BannerImgId { get; set; }
|
||||||
|
public string? ProfileImg { get; set; }
|
||||||
|
// public Models.Document? ProfileImgId { get; set; }
|
||||||
|
public string? NameTh { get; set; }
|
||||||
|
public string? NameEn { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public string? About { get; set; }
|
||||||
|
public string? Address { get; set; }
|
||||||
|
// public Models.Province? Province { get; set; }
|
||||||
|
public string? ProvinceId { get; set; }
|
||||||
|
// public Models.District? District { get; set; }
|
||||||
|
public string? DistrictId { get; set; }
|
||||||
|
// public Models.SubDistrict? SubDistrict { get; set; }
|
||||||
|
public string? SubDistrictId { get; set; }
|
||||||
|
public string? ZipCode { get; set; }
|
||||||
|
public string? Telephone { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Request/RequestCMSAgency.cs
Normal file
14
Request/RequestCMSAgency.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||||
|
{
|
||||||
|
public class RequestAgency
|
||||||
|
{
|
||||||
|
public List<RequestCMSAgency> Agency { get; set; }
|
||||||
|
}
|
||||||
|
public class RequestCMSAgency
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Link { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Request/RequestCMSDetail.cs
Normal file
11
Request/RequestCMSDetail.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||||
|
{
|
||||||
|
public class RequestCMSDetail
|
||||||
|
{
|
||||||
|
public string? NameTh { get; set; }
|
||||||
|
public string? NameEn { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Request/RequestCMSGovernment.cs
Normal file
14
Request/RequestCMSGovernment.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||||
|
{
|
||||||
|
public class RequestGovernment
|
||||||
|
{
|
||||||
|
public List<RequestCMSGovernment> Government { get; set; }
|
||||||
|
}
|
||||||
|
public class RequestCMSGovernment
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? Link { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
236
Services/CMSCandidateService.cs
Normal file
236
Services/CMSCandidateService.cs
Normal file
|
|
@ -0,0 +1,236 @@
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text.Json;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Core;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Data;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Request;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Responses.Document;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using OfficeOpenXml;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
|
{
|
||||||
|
public class CMSCandidateService
|
||||||
|
{
|
||||||
|
#region " Fields "
|
||||||
|
|
||||||
|
private readonly ApplicationDbContext _context;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly MinIOService _minioService;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
|
public CMSCandidateService(ApplicationDbContext context,
|
||||||
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
MinIOService minioService)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_minioService = minioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task<CMSCandidate> GetsAsync()
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
return cms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CMSCandidate> createCMS()
|
||||||
|
{
|
||||||
|
var cmsCandidates = await _context.CMSCandidates.AsQueryable()
|
||||||
|
.Include(x => x.BannerImg)
|
||||||
|
.Include(x => x.LogoImg)
|
||||||
|
.Include(x => x.CMSAgencys)
|
||||||
|
.Include(x => x.CMSGovernments)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (cmsCandidates == null)
|
||||||
|
{
|
||||||
|
cmsCandidates = new CMSCandidate
|
||||||
|
{
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _context.CMSCandidates.AddAsync(cmsCandidates);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmsCandidates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateDetailAsync(RequestCMSAbout updated)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
cms.NameTh = updated.NameTh;
|
||||||
|
cms.NameEn = updated.NameEn;
|
||||||
|
cms.Description = updated.Description;
|
||||||
|
cms.LastUpdatedAt = DateTime.Now;
|
||||||
|
cms.LastUpdateUserId = UserId ?? "";
|
||||||
|
cms.LastUpdateFullName = FullName ?? "";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateAboutAsync(RequestCMSAbout updated)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
if (updated.ProvinceId != null)
|
||||||
|
{
|
||||||
|
var province = await _context.Provinces.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId));
|
||||||
|
|
||||||
|
if (province == null)
|
||||||
|
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||||
|
|
||||||
|
cms.Province = province;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updated.DistrictId != null)
|
||||||
|
{
|
||||||
|
var pistrict = await _context.Districts.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId));
|
||||||
|
|
||||||
|
if (pistrict == null)
|
||||||
|
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||||
|
|
||||||
|
cms.District = pistrict;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updated.SubDistrictId != null)
|
||||||
|
{
|
||||||
|
var subDistrict = await _context.SubDistricts.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId));
|
||||||
|
|
||||||
|
if (subDistrict == null)
|
||||||
|
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||||
|
|
||||||
|
cms.SubDistrict = subDistrict;
|
||||||
|
cms.ZipCode = subDistrict.ZipCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
cms.NameTh = updated.About;
|
||||||
|
cms.NameEn = updated.Address;
|
||||||
|
cms.Description = updated.Telephone;
|
||||||
|
cms.LastUpdatedAt = DateTime.Now;
|
||||||
|
cms.LastUpdateUserId = UserId ?? "";
|
||||||
|
cms.LastUpdateFullName = FullName ?? "";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateLogoAsync(IFormFile file)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
if (cms.LogoImg != null)
|
||||||
|
{
|
||||||
|
await DeleteAsyncDocument(cms.LogoImg.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
var doc = await _minioService.UploadFileAsync(file);
|
||||||
|
|
||||||
|
var document = await _context.Documents.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
|
|
||||||
|
cms.LogoImg = document;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateBannerAsync(IFormFile file)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
if (cms.BannerImg != null)
|
||||||
|
{
|
||||||
|
await DeleteAsyncDocument(cms.BannerImg.Id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
var doc = await _minioService.UploadFileAsync(file);
|
||||||
|
|
||||||
|
var document = await _context.Documents.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
|
|
||||||
|
cms.BannerImg = document;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteAsyncDocument(string documentId)
|
||||||
|
{
|
||||||
|
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateAgencyAsync(List<RequestCMSAgency> updated)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
_context.CMSAgencys.RemoveRange(cms.CMSAgencys);
|
||||||
|
|
||||||
|
foreach (var agencyData in updated)
|
||||||
|
{
|
||||||
|
var agency = new CMSAgency
|
||||||
|
{
|
||||||
|
CMSCandidate = cms,
|
||||||
|
Name = agencyData.Name,
|
||||||
|
Link = agencyData.Link,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _context.AddAsync(agency);
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateGovernmentAsync(List<RequestCMSGovernment> updated)
|
||||||
|
{
|
||||||
|
var cms = await createCMS();
|
||||||
|
|
||||||
|
_context.CMSGovernments.RemoveRange(cms.CMSGovernments);
|
||||||
|
|
||||||
|
foreach (var governmentData in updated)
|
||||||
|
{
|
||||||
|
var government = new CMSGovernment
|
||||||
|
{
|
||||||
|
CMSCandidate = cms,
|
||||||
|
Name = governmentData.Name,
|
||||||
|
Link = governmentData.Link,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _context.AddAsync(government);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue