From 32d96d62c159f8babbf0d219007425132263a401 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Sun, 24 Apr 2022 09:16:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.Application/Service/Visit/SubjectService.cs | 6 ++++--
IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs | 2 ++
IRaCIS.Core.Infra.EFCore/Repository/Repository.cs | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs
index c24d1717f..26577be2f 100644
--- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs
+++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs
@@ -66,12 +66,14 @@ namespace IRaCIS.Application.Services
svlist.ForEach(t =>
{
+ t.SubjectId= mapedSubject.Id,
t.TrialId = subjectCommand.TrialId;
t.SiteId = subjectCommand.SiteId;
t.IsEnrollmentConfirm = t.IsBaseLine ? IsEnrollementQualificationConfirm : false;
});
- mapedSubject.SubjectVisitList = svlist;
+
+ await _subjectVisitRepository.AddRangeAsync(svlist);
}
else //update
{
@@ -239,7 +241,7 @@ namespace IRaCIS.Application.Services
}
var isSuccess = await _subjectRepository.BatchDeleteAsync(u => u.Id == id);
- await _subjectVisitRepository.BatchDeleteAsync(u => u.SubjectId == id);
+ await _subjectVisitRepository.TrackingBatchDeleteAsync(u => u.SubjectId == id);
var subvisit = await _subjectVisitRepository.Where(x => x.SubjectId == id).ToListAsync();
diff --git a/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs b/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs
index 7cb2ef195..3ada949c7 100644
--- a/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs
+++ b/IRaCIS.Core.Application/Triggers/AddVisitPlanTrigger.cs
@@ -48,6 +48,8 @@ namespace IRaCIS.Core.Application.Triggers
await _subjectVisitRepository.AddAsync(svItem);
}
+
+ await _subjectVisitRepository.SaveChangesAsync();
}
}
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
index 79a1e897a..758252f35 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
@@ -225,6 +225,8 @@ namespace IRaCIS.Core.Infra.EFCore
}
+
+
/// EF跟踪方式 删除
public async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{