api ข้อมูลประวัติการศึกษา
This commit is contained in:
parent
85bc0fd359
commit
3d1ff7ee72
2 changed files with 88 additions and 3 deletions
|
|
@ -688,5 +688,74 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPut("education/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdateEducationByPerson([FromBody] PersonEducationRequest req, Guid personalId)
|
||||||
|
{
|
||||||
|
var education = await _context.PlacementEducations
|
||||||
|
.Include(x => x.PlacementProfile)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||||
|
if (education == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
if (req.Id == null)
|
||||||
|
{
|
||||||
|
var data = new PlacementEducation
|
||||||
|
{
|
||||||
|
PlacementProfile = education.PlacementProfile,
|
||||||
|
Institute = req.Institute,
|
||||||
|
Degree = req.Degree,
|
||||||
|
Field = req.Field,
|
||||||
|
Gpa = req.Gpa,
|
||||||
|
Country = req.Country,
|
||||||
|
Duration = req.Duration,
|
||||||
|
DurationYear = req.DurationYear,
|
||||||
|
Other = req.Other,
|
||||||
|
FundName = req.FundName,
|
||||||
|
FinishDate = req.FinishDate,
|
||||||
|
StartDate = req.StartDate,
|
||||||
|
EndDate = req.EndDate,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
await _context.PlacementEducations.AddAsync(data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
education.Institute = req.Institute;
|
||||||
|
education.Degree = req.Degree;
|
||||||
|
education.Field = req.Field;
|
||||||
|
education.Gpa = req.Gpa;
|
||||||
|
education.Country = req.Country;
|
||||||
|
education.Duration = req.Duration;
|
||||||
|
education.DurationYear = req.DurationYear;
|
||||||
|
education.Other = req.Other;
|
||||||
|
education.FundName = req.FundName;
|
||||||
|
education.FinishDate = req.FinishDate;
|
||||||
|
education.StartDate = req.StartDate;
|
||||||
|
education.EndDate = req.EndDate;
|
||||||
|
education.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
education.LastUpdateUserId = UserId ?? "";
|
||||||
|
education.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("education/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> DeleteEducation(Guid personalId)
|
||||||
|
{
|
||||||
|
var education = await _context.PlacementEducations.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||||
|
if (education == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
_context.PlacementEducations.Remove(education);
|
||||||
|
_context.SaveChanges();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,23 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
{
|
{
|
||||||
public class PersonEducationRequest
|
public class PersonEducationRequest
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
//public string Name { get; set; }
|
||||||
public bool Value { get; set; }
|
//public bool Value { get; set; }
|
||||||
|
public Guid? Id { get; set; }
|
||||||
|
public Guid? EducationLevelId { get; set; }
|
||||||
|
public Guid? PositionPathId { get; set; }
|
||||||
|
public string Institute { get; set; }
|
||||||
|
public string Degree { get; set; }
|
||||||
|
public string Field { get; set; }
|
||||||
|
public string Gpa { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public string Duration { get; set; }
|
||||||
|
public int DurationYear { get; set; }
|
||||||
|
public string Other { get; set; }
|
||||||
|
public string FundName { get; set; }
|
||||||
|
public DateTime FinishDate { get; set; }
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
public DateTime EndDate { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue