修改
continuous-integration/drone/push Build is running Details

Test_IRC_Net8
Hewt 2026-03-20 11:05:09 +08:00
parent 7a8ec6221f
commit f4fc51b66d
2 changed files with 38 additions and 13 deletions

View File

@ -24,9 +24,21 @@ public class SaveSegmentBindingAndAnswerInDto
public List<SaveSegmentBindingDto> BindingList { get; set; } public List<SaveSegmentBindingDto> BindingList { get; set; }
} }
public class SaveSegmentBindingDto : SegmentBindingAddOrEdit public class SaveSegmentBindingDto
{ {
public string Answer { get; set; } public string Answer { get; set; }
public Guid? QuestionId { get; set; }
public Guid? RowId { get; set; }
public Guid? SegmentId { get; set; }
public Guid? SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid VisitTaskId { get; set; }
} }
public class SegmentBindingAddOrEdit public class SegmentBindingAddOrEdit

View File

@ -11,6 +11,7 @@ using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Infrastructure.Extention;
using System.Threading.Tasks; using System.Threading.Tasks;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using Microsoft.Extensions.Logging;
namespace IRaCIS.Core.Application.Service; namespace IRaCIS.Core.Application.Service;
/// <summary> /// <summary>
@ -209,23 +210,35 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (binding == null) if (binding == null)
{ {
await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding if (item.SegmentationId != null && item.SegmentId != null)
{ {
VisitTaskId = inDto.VisitTaskId, await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding
QuestionId = item.QuestionId, {
RowId = item.RowId, VisitTaskId = inDto.VisitTaskId,
TableQuestionId = item.TableQuestionId, QuestionId = item.QuestionId,
SegmentId = item.SegmentId, RowId = item.RowId,
SegmentationId = item.SegmentationId, TableQuestionId = item.TableQuestionId,
}); SegmentId = item.SegmentId.Value,
SegmentationId = item.SegmentationId.Value,
});
}
} }
else else
{ {
await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding if (item.SegmentationId != null && item.SegmentId != null)
{ {
SegmentId = item.SegmentId, await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding
SegmentationId = item.SegmentationId, {
}); SegmentId = item.SegmentId.Value,
SegmentationId = item.SegmentationId.Value,
});
}
else
{
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.Id == binding.Id);
}
} }