修改
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
7a8ec6221f
commit
f4fc51b66d
|
|
@ -24,9 +24,21 @@ public class SaveSegmentBindingAndAnswerInDto
|
|||
public List<SaveSegmentBindingDto> BindingList { get; set; }
|
||||
}
|
||||
|
||||
public class SaveSegmentBindingDto : SegmentBindingAddOrEdit
|
||||
public class SaveSegmentBindingDto
|
||||
{
|
||||
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
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using IRaCIS.Core.Application.ViewModel;
|
|||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using System.Threading.Tasks;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
namespace IRaCIS.Core.Application.Service;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -208,6 +209,8 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
var binding = await _segmentBindingRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (binding == null)
|
||||
{
|
||||
if (item.SegmentationId != null && item.SegmentId != null)
|
||||
{
|
||||
await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding
|
||||
{
|
||||
|
|
@ -215,17 +218,27 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
|||
QuestionId = item.QuestionId,
|
||||
RowId = item.RowId,
|
||||
TableQuestionId = item.TableQuestionId,
|
||||
SegmentId = item.SegmentId,
|
||||
SegmentationId = item.SegmentationId,
|
||||
SegmentId = item.SegmentId.Value,
|
||||
SegmentationId = item.SegmentationId.Value,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.SegmentationId != null && item.SegmentId != null)
|
||||
{
|
||||
await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding
|
||||
{
|
||||
SegmentId = item.SegmentId.Value,
|
||||
SegmentationId = item.SegmentationId.Value,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding
|
||||
{
|
||||
SegmentId = item.SegmentId,
|
||||
SegmentationId = item.SegmentationId,
|
||||
});
|
||||
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.Id == binding.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue