แก้สมัครสอบ

This commit is contained in:
kittapath 2025-01-05 21:59:15 +07:00
parent afc0cd830c
commit 07903d3b67
30 changed files with 3471 additions and 771 deletions

View file

@ -19,7 +19,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata;
private readonly OrgDbContext _contextOrg;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly MinIOService _minioService;
@ -28,12 +28,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Constructor and Destructor "
public CMSCandidateService(ApplicationDbContext context,
MetadataDbContext contextMetadata,
OrgDbContext contextOrg,
IHttpContextAccessor httpContextAccessor,
MinIOService minioService)
{
_context = context;
_contextMetadata = contextMetadata;
_contextOrg = contextOrg;
_httpContextAccessor = httpContextAccessor;
_minioService = minioService;
}
@ -139,39 +139,39 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (updated.ProvinceId != null)
{
var province = await _contextMetadata.Provinces.AsQueryable()
var province = await _contextOrg.province.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId));
if (province == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
cms.ProvinceId = province.Id;
cms.ProvinceName = province.Name;
cms.ProvinceName = province.name;
}
if (updated.DistrictId != null)
{
var pistrict = await _contextMetadata.Districts.AsQueryable()
var pistrict = await _contextOrg.district.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId));
if (pistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
cms.DistrictId = pistrict.Id;
cms.DistrictName = pistrict.Name;
cms.DistrictName = pistrict.name;
}
if (updated.SubDistrictId != null)
{
var subDistrict = await _contextMetadata.SubDistricts.AsQueryable()
var subDistrict = await _contextOrg.subDistrict.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId));
if (subDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
cms.SubDistrictId = subDistrict.Id;
cms.SubDistrictName = subDistrict.Name;
cms.ZipCode = subDistrict.ZipCode;
cms.SubDistrictName = subDistrict.name;
cms.ZipCode = subDistrict.zipCode;
}
cms.About = updated.About;