Uat_Study
parent
f8720f9c1d
commit
0cd9d1867c
|
@ -135,6 +135,10 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var questionAnswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
var tableQuestionAnswerList= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
|
||||
foreach (var item in inDto.QuestionAnswer)
|
||||
{
|
||||
|
@ -162,11 +166,33 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
foreach (var item in inDto.TableQuestionAnswer)
|
||||
{
|
||||
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId&&x.TableQuestionId==item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
||||
|
||||
if (tableQuestionAnswerList.Any(x => x.QuestionId == item.QuestionId&&x.RowId==item.RowId&&x.TableQuestionId==item.TableQuestionId))
|
||||
{
|
||||
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var rowInfo = rowInfoList.Where(x => x.Id == item.RowId).FirstOrDefault()??new ReadingTableAnswerRowInfo ();
|
||||
|
||||
await _readingTableQuestionAnswerRepository.AddAsync(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
QuestionId=item.QuestionId,
|
||||
TableQuestionId=item.TableQuestionId,
|
||||
RowIndex= rowInfo.RowIndex,
|
||||
RowId=rowInfo.Id,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
TrialId = visitTask.TrialId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue