From 8d64f8bb4a74d1a3d8ac10dcfd84e5cdc453aac2 Mon Sep 17 00:00:00 2001
From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com>
Date: Thu, 30 Mar 2023 15:07:35 +0700
Subject: [PATCH] =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=AD=20Api=20period=20ex?=
=?UTF-8?q?am?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Controllers/PeriodExamController.cs | 25 +++++++++++++++++++++++++
Services/PeriodExamService.cs | 27 +++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/Controllers/PeriodExamController.cs b/Controllers/PeriodExamController.cs
index 91730b9..54096a3 100644
--- a/Controllers/PeriodExamController.cs
+++ b/Controllers/PeriodExamController.cs
@@ -265,7 +265,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
return Error(ex);
}
}
+
+ ///
+ /// ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
+ ///
+ /// รหัสรอบสมัคร
+ ///
+ /// เมื่อทำการดึง ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("information/{candidate:length(36)}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> GetsAsyncInformation(string candidate)
+ {
+ try
+ {
+ var items = await _periodExamService.GetsAsyncInformation(candidate);
+ return Success(items);
+ }
+ catch (Exception ex)
+ {
+ return Error(ex);
+ }
+ }
#endregion
}
}
diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs
index 789d2d8..3abc171 100644
--- a/Services/PeriodExamService.cs
+++ b/Services/PeriodExamService.cs
@@ -143,6 +143,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}
}
+ public async Task GetsAsyncInformation(string candidateId)
+ {
+ return await _context.Candidates.AsQueryable()
+ .Where(x => x.Id == Guid.Parse(candidateId))
+ .Select(x => new CandidateInformationResponseItem
+ {
+ Prefix = x.Prefix,
+ PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
+ FirstName = x.FirstName,
+ LastName = x.LastName,
+ Nationality = x.Nationality,
+ DateOfBirth = x.DateOfBirth,
+ Relationship = x.Relationship,
+ RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
+ CitizenProvince = x.CitizenProvince,
+ CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
+ CitizenDistrict = x.CitizenDistrict,
+ CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
+ CitizenDate = x.CitizenDate,
+ Email = x.Email,
+ CitizenId = x.CitizenId,
+ Telephone = x.Telephone,
+ MobilePhone = x.MobilePhone,
+ Knowledge = x.Knowledge,
+ })
+ .FirstOrDefaultAsync();
+ }
#endregion
}
}