แก้ชื่อฟังก์ชันประวัติการศึกษา

This commit is contained in:
Kittapath 2023-07-06 14:41:39 +07:00
parent 9e4850f6bf
commit af00016801

View file

@ -709,23 +709,8 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success(); return Success();
} }
[HttpGet("education/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
{
var person = await _context.PlacementProfiles.FindAsync(personalId);
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
person.LastUpdateFullName = FullName ?? "System Administrator";
person.LastUpdateUserId = UserId ?? "";
person.LastUpdatedAt = DateTime.Now;
_context.SaveChanges();
return Success();
}
[HttpPut("education/{personalId:length(36)}")] [HttpPut("education/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateEducationByPerson([FromBody] PersonEducationRequest req, Guid personalId) public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
{ {
var education = await _context.PlacementEducations var education = await _context.PlacementEducations
.Include(x => x.PlacementProfile) .Include(x => x.PlacementProfile)
@ -733,18 +718,18 @@ namespace BMA.EHR.Placement.Service.Controllers
if (education == null) if (education == null)
return Error(GlobalMessages.DataNotFound, 404); return Error(GlobalMessages.DataNotFound, 404);
if (req.Id == null) if (req.Id == null)
{ {
var data = new PlacementEducation var data = new PlacementEducation
{ {
PlacementProfile = education.PlacementProfile, PlacementProfile = education.PlacementProfile,
Institute = req.Institute, Institute = req.Institute,
Degree = req.Degree, Degree = req.Degree,
Field = req.Field, Field = req.Field,
Gpa = req.Gpa, Gpa = req.Gpa,
Country = req.Country, Country = req.Country,
Duration = req.Duration, Duration = req.Duration,
DurationYear = req.DurationYear, DurationYear = req.DurationYear,
Other = req.Other, Other = req.Other,
FundName = req.FundName, FundName = req.FundName,
FinishDate = req.FinishDate, FinishDate = req.FinishDate,
@ -761,7 +746,7 @@ namespace BMA.EHR.Placement.Service.Controllers
} }
else else
{ {
education.Institute = req.Institute; education.Institute = req.Institute;
education.Degree = req.Degree; education.Degree = req.Degree;
education.Field = req.Field; education.Field = req.Field;
education.Gpa = req.Gpa; education.Gpa = req.Gpa;