修改
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 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
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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)
|
var binding = await _segmentBindingRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (binding == null)
|
if (binding == null)
|
||||||
|
{
|
||||||
|
if (item.SegmentationId != null && item.SegmentId != null)
|
||||||
{
|
{
|
||||||
await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding
|
await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding
|
||||||
{
|
{
|
||||||
|
|
@ -215,17 +218,27 @@ public class SegmentationService(IRepository<Segmentation> _segmentationReposito
|
||||||
QuestionId = item.QuestionId,
|
QuestionId = item.QuestionId,
|
||||||
RowId = item.RowId,
|
RowId = item.RowId,
|
||||||
TableQuestionId = item.TableQuestionId,
|
TableQuestionId = item.TableQuestionId,
|
||||||
SegmentId = item.SegmentId,
|
SegmentId = item.SegmentId.Value,
|
||||||
SegmentationId = item.SegmentationId,
|
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
|
else
|
||||||
{
|
{
|
||||||
await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding
|
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.Id == binding.Id);
|
||||||
{
|
}
|
||||||
SegmentId = item.SegmentId,
|
|
||||||
SegmentationId = item.SegmentationId,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue