diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 05384390d..36f55cde0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -93,6 +93,13 @@ namespace IRaCIS.Core.Application.Service.Allocation { await _subjectUserRepository.AddAsync(new SubjectUser() {TrialId=command.TrialId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now }); + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.TrialId==command.TrialId, u => new VisitTask() + { + AllocateTime = DateTime.Now, + DoctorUserId = command.DoctorUserId, + TaskAllocationState = TaskAllocationState.Allocated + }); + } } } @@ -150,7 +157,7 @@ namespace IRaCIS.Core.Application.Service.Allocation await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id); - await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum, u => new VisitTask() + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum, u => new VisitTask() { AllocateTime=null, DoctorUserId=null,