api อัพโหลดหลักฐานชำระเงิน

This commit is contained in:
Kittapath 2023-04-03 12:05:57 +07:00
parent eb8047e7ad
commit dee47f326d
6 changed files with 155 additions and 136 deletions

View file

@ -258,7 +258,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.Include(x=>x.ProfileImg)
.Include(x => x.ProfileImg)
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
@ -277,7 +277,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.Include(x=>x.PaymentImg)
.Include(x => x.PaymentImg)
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
@ -594,11 +594,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (candidate.ProfileImg != null)
{
await DeleteAsyncDocument(candidate.ProfileImg.Id.ToString());
}
var doc = await _minioService.UploadFileAsync(file);
var document = await _context.Documents.AsQueryable()
@ -1010,11 +1016,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PaymentImg)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (candidate.PaymentImg != null)
{
await DeleteAsyncDocument(candidate.PaymentImg.Id.ToString());
}
var doc = await _minioService.UploadFileAsync(file);
var document = await _context.Documents.AsQueryable()