diff --git a/Services/CandidateService.cs b/Services/CandidateService.cs index ae41bb6..17ec119 100644 --- a/Services/CandidateService.cs +++ b/Services/CandidateService.cs @@ -1259,9 +1259,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services if (candidate == null) throw new Exception(GlobalMessages.ExamNotFound); - string profileImgId = candidate.ProfileImg.Id.ToString(); if (candidate.ProfileImg != null) { + string profileImgId = candidate.ProfileImg.Id.ToString(); //ลบ FK ในเบสก่อนแล้วค่อยไปลบที่ minIo candidate.ProfileImg = null; await _context.SaveChangesAsync(); @@ -1286,9 +1286,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services if (candidate == null) throw new Exception(GlobalMessages.ExamNotFound); - string profileImgId = candidate.ProfileImg.Id.ToString(); if (candidate.ProfileImg != null) { + string profileImgId = candidate.ProfileImg.Id.ToString(); //ลบ FK ในเบสก่อนแล้วค่อยไปลบที่ minIo candidate.ProfileImg = null; await _context.SaveChangesAsync();