แก้ api fileImageCandidate
This commit is contained in:
parent
d16435c2c9
commit
9cf8135301
2 changed files with 68 additions and 85 deletions
|
|
@ -550,6 +550,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task UpdateAsyncProfileImage(string examId, IFormFile file)
|
||||
{
|
||||
var candidateId = await CreateAsyncCandidate(examId);
|
||||
|
||||
var candidate = await _context.Candidates.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
|
||||
|
||||
if (candidate == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var doc = await _minioService.UploadFileAsync(file);
|
||||
|
||||
var document = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
|
||||
candidate.ProfileImg = document;
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task UpdateAsyncAddress(string examId, CandidateAddressResponseItem updated)
|
||||
{
|
||||
var candidateId = await CreateAsyncCandidate(examId);
|
||||
|
|
@ -731,18 +750,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteAsyncDocument(string documentId)
|
||||
{
|
||||
var document = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(documentId));
|
||||
// public async Task DeleteAsyncDocument(string documentId)
|
||||
// {
|
||||
// // var document = await _context.Documents.AsQueryable()
|
||||
// // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(documentId));
|
||||
|
||||
if (document == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
// // if (document == null)
|
||||
// // throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
|
||||
_context.Documents.Remove(document);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
// // _context.Documents.Remove(document);
|
||||
// var doc = await _minioService.DeleteFileAsync(documentId);
|
||||
// return "uy";
|
||||
// // await _context.SaveChangesAsync();
|
||||
// }
|
||||
|
||||
public async Task CreateAsyncCareer(string examId, CandidateCareerResponseItem updated)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue