แก้ฟิวnull placement education

This commit is contained in:
Kittapath 2023-07-06 15:27:15 +07:00
parent af00016801
commit b7afae1e7d
2 changed files with 21 additions and 15 deletions

View file

@ -712,17 +712,19 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPut("education/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
{
var education = await _context.PlacementEducations
.Include(x => x.PlacementProfile)
// var education = await _context.PlacementEducations
// .Include(x => x.PlacementProfile)
// .FirstOrDefaultAsync(x => x.Id == personalId);
var profile = await _context.PlacementProfiles
.FirstOrDefaultAsync(x => x.Id == personalId);
if (education == null)
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
if (req.Id == null)
{
var data = new PlacementEducation
{
PlacementProfile = education.PlacementProfile,
PlacementProfile = profile,
Institute = req.Institute,
Degree = req.Degree,
Field = req.Field,
@ -746,6 +748,10 @@ namespace BMA.EHR.Placement.Service.Controllers
}
else
{
var education = await _context.PlacementEducations
.FirstOrDefaultAsync(x => x.Id == req.Id);
if (education == null)
return Error(GlobalMessages.DataNotFound, 404);
education.Institute = req.Institute;
education.Degree = req.Degree;
education.Field = req.Field;

View file

@ -10,18 +10,18 @@ namespace BMA.EHR.Placement.Service.Requests
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 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; }
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; }
}
}