|
@@ -642,7 +642,9 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
// 简单和填空没有选项
|
|
|
if (actionRequest.QuestionType.CheckSelectType()) return null;
|
|
|
|
|
|
- var questionAnswer = _mapper.Map<QuestionAnswer>(actionRequest.QuestionAnswerDto);
|
|
|
+ var questionAnswer = await _questionAnswerRepository.GetAsync(actionRequest.QuestionAnswerDto.Id);
|
|
|
+
|
|
|
+ questionAnswer = _mapper.Map<UpdateQuestionAnswerDto, QuestionAnswer>(actionRequest.QuestionAnswerDto, questionAnswer);
|
|
|
|
|
|
questionAnswer.QuestionId = actionRequest.Id;
|
|
|
|
|
@@ -812,21 +814,23 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
if (actionRequest.QuestionAnswerDto.Id != null)
|
|
|
{
|
|
|
actionRequest.QuestionAnswerDto.OperationStatus = EEOperationStatus.Update;
|
|
|
- }
|
|
|
|
|
|
- var add = await AddQuestionAnswer(_addQuestionDto, cancellationToken);
|
|
|
+ var update = await UpdateQuestionAnswer(actionRequest, cancellationToken);
|
|
|
|
|
|
- if (add!=null)
|
|
|
- {
|
|
|
- questionAnswers.AddRange(add);
|
|
|
+ if (update != null)
|
|
|
+ {
|
|
|
+ questionAnswers.Add(update);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- var update= await UpdateQuestionAnswer(actionRequest, cancellationToken);
|
|
|
-
|
|
|
- if(update != null)
|
|
|
+ else
|
|
|
{
|
|
|
- questionAnswers.Add(update);
|
|
|
- }
|
|
|
+ var add = await AddQuestionAnswer(_addQuestionDto, cancellationToken);
|
|
|
+
|
|
|
+ if (add != null)
|
|
|
+ {
|
|
|
+ questionAnswers.AddRange(add);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (actionRequest.QuestionAnswerDto != null && actionRequest.QuestionAnswerDto.OperationStatus == EEOperationStatus.Delete)
|
|
|
{
|