@@ -1,5 +1,6 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -14,6 +15,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
public class AttachmentService(IRepository<Attachment> _attachmentrepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<Enroll> _enrollRepository,
|
||||
IOSSService _oSSService,
|
||||
IRepository<Doctor> _doctorrepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IAttachmentService
|
||||
{
|
||||
|
||||
@@ -211,6 +213,19 @@ namespace IRaCIS.Core.Application.Service
|
||||
public async Task<IResponseOutput> UpdateTrialAttachments(AttachmentDTO attachment)
|
||||
{
|
||||
|
||||
if (!attachment.Path.Contains(attachment.DoctorId.ToString()))
|
||||
{
|
||||
var attachmentData= await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachment.Id);
|
||||
|
||||
var fileName= attachmentData.Path.Split("/").Last();
|
||||
|
||||
|
||||
attachment.Path = $"/systemData/reviewe/{attachment.Type}/{attachment.DoctorId}/{fileName}`";
|
||||
|
||||
_oSSService.MoveObject(attachmentData.Path, attachment.Path);
|
||||
|
||||
}
|
||||
|
||||
if (attachment.DoctorId != null)
|
||||
{
|
||||
await _attachmentrepository.DeleteFromQueryAsync(a => a.DoctorId == attachment.DoctorId && a.Type == attachment.Type);
|
||||
|
||||
Reference in New Issue
Block a user