@@ -8,6 +8,7 @@ namespace IRaCIS.Application.Services
|
||||
public class TrialExperienceService(
|
||||
IRepository<TrialExperience> _trialExperienceRepository,
|
||||
IRepository<Doctor> _doctorRepository,
|
||||
IRepository<TrialExperienceCriteria> _trialExperienceCriteriaRepository,
|
||||
IRepository<Attachment> _attachmentRepository
|
||||
) : BaseService, ITrialExperienceService
|
||||
{
|
||||
@@ -67,7 +68,7 @@ namespace IRaCIS.Application.Services
|
||||
var trialExperience =
|
||||
_mapper.Map<TrialExperience>(trialExperienceViewModel);
|
||||
|
||||
trialExperience = await _repository.AddAsync(trialExperience);
|
||||
trialExperience = await _trialExperienceRepository.AddAsync(trialExperience);
|
||||
|
||||
List<TrialExperienceCriteria> criteriaList = new List<TrialExperienceCriteria>();
|
||||
trialExperienceViewModel.EvaluationCriteriaIdList.ForEach(t => criteriaList.Add(new TrialExperienceCriteria()
|
||||
@@ -78,7 +79,7 @@ namespace IRaCIS.Application.Services
|
||||
TrialExperienceId = trialExperience.Id
|
||||
}));
|
||||
|
||||
await _repository.AddRangeAsync(criteriaList);
|
||||
await _trialExperienceCriteriaRepository.AddRangeAsync(criteriaList);
|
||||
|
||||
|
||||
var success = await _repository.SaveChangesAsync();
|
||||
@@ -93,7 +94,7 @@ namespace IRaCIS.Application.Services
|
||||
_mapper.Map(trialExperienceViewModel, needUpdate);
|
||||
await _repository.UpdateAsync(needUpdate);
|
||||
|
||||
await _repository.BatchDeleteAsync<TrialExperienceCriteria>(t => t.TrialExperienceId == needUpdate.Id);
|
||||
await _trialExperienceCriteriaRepository.BatchDeleteNoTrackingAsync(t => t.TrialExperienceId == needUpdate.Id);
|
||||
|
||||
List<TrialExperienceCriteria> criteriaList = new List<TrialExperienceCriteria>();
|
||||
|
||||
@@ -119,7 +120,7 @@ namespace IRaCIS.Application.Services
|
||||
[HttpDelete, Route("{doctorId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialExperience(Guid doctorId)
|
||||
{
|
||||
var success = await _repository.BatchDeleteAsync<TrialExperience>(o => o.Id == doctorId);
|
||||
var success = await _trialExperienceRepository.BatchDeleteNoTrackingAsync(o => o.Id == doctorId);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -133,7 +134,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
//_attachmentRepository.Delete(t => t.DoctorId == updateGCPExperienceParam.Id && t.Type == StaticData.GCP);
|
||||
|
||||
var successs = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
|
||||
var successs = await _doctorRepository.BatchUpdateNoTrackingAsync(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
|
||||
{
|
||||
GCP = updateGCPExperienceParam.GCP,
|
||||
GCPId = (updateGCPExperienceParam.GCP==0||updateGCPExperienceParam.GCPId==null)?Guid.Empty: updateGCPExperienceParam.GCPId!.Value
|
||||
@@ -141,7 +142,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (updateGCPExperienceParam.GCP == 0 )
|
||||
{
|
||||
await _repository.BatchDeleteAsync<Attachment>(a => a.DoctorId == updateGCPExperienceParam.Id && a.Type=="GCP");
|
||||
await _attachmentRepository.BatchDeleteNoTrackingAsync(a => a.DoctorId == updateGCPExperienceParam.Id && a.Type=="GCP");
|
||||
}
|
||||
|
||||
return ResponseOutput.Result(successs, updateGCPExperienceParam.GCPId.ToString());
|
||||
@@ -155,7 +156,7 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> UpdateOtherExperience(ClinicalExperienceCommand updateOtherClinicalExperience)
|
||||
{
|
||||
var success = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
|
||||
var success = await _doctorRepository.BatchUpdateNoTrackingAsync(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
|
||||
{
|
||||
OtherClinicalExperience = updateOtherClinicalExperience.OtherClinicalExperience ?? string.Empty,
|
||||
OtherClinicalExperienceCN = updateOtherClinicalExperience.OtherClinicalExperienceCN ?? string.Empty
|
||||
|
||||
Reference in New Issue
Block a user