|
@@ -1,11 +1,14 @@
|
|
|
-using Exam.Application;
|
|
|
+using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
+using Exam.Application;
|
|
|
using Exam.Application.Interface.Questions;
|
|
|
using Exam.ExamManages;
|
|
|
using Exam.Infrastructure.Data.Entity;
|
|
|
using Exam.Infrastructure.Enums;
|
|
|
+using Exam.Infrastructure.Extensions;
|
|
|
+using Exam.Infrastructure.Web.Extensions;
|
|
|
+using Exam.Infrastructure.Web.Utilities;
|
|
|
using Exam.Insfrastructure.Service.Service;
|
|
|
using Exam.Questions;
|
|
|
-using Exam.Repository.Sqlsugar;
|
|
|
using Exam.Repository.Sqlsugar.Repositories;
|
|
|
using Exam.Share.ViewResponses.Question;
|
|
|
using Hotline.Application.Exam.QueryExtensions.Questions;
|
|
@@ -16,23 +19,15 @@ using Hotline.Repository.SqlSugar.Exam.Interfaces.Questions;
|
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
|
using Hotline.Share.Dtos.Questions;
|
|
|
using Hotline.Share.Requests.Question;
|
|
|
-using Mapster;
|
|
|
+using JiebaNet.Segmenter.Common;
|
|
|
+using MapsterMapper;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Dependency;
|
|
|
-using Exam.Infrastructure.Data.Extensions;
|
|
|
-using Exam.Infrastructure.Data.Interface;
|
|
|
-using Hotline.Import;
|
|
|
-using Exam.Infrastructure.Web.Utilities;
|
|
|
-using XF.Domain.Repository;
|
|
|
-using MapsterMapper;
|
|
|
using XF.Domain.Entities;
|
|
|
-using Exam.Infrastructure.Extensions;
|
|
|
-using Exam.Infrastructure.Web.Extensions;
|
|
|
-using JiebaNet.Segmenter.Common;
|
|
|
|
|
|
namespace Hotline.Application.Exam.Service.Questions
|
|
|
{
|
|
|
- public class QuestionService : ApiService<Question, QuestionDto, HotlineDbContext>, IQuestionService, IScopeDependency
|
|
|
+ public class QuestionService : ApiService<Question, AddQuestionDto,UpdateQuestionDto, HotlineDbContext>, IQuestionService, IScopeDependency
|
|
|
{
|
|
|
#region ctor
|
|
|
private readonly IQuestionRepository _repository;
|
|
@@ -95,21 +90,15 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
var expression = queryRequest.GetExpression();
|
|
|
var questionTable = _repository.Queryable().Where(expression);
|
|
|
|
|
|
- var questionTagExpression = queryRequest.GetQuestionTagExpression();
|
|
|
- var questionTagTable = _questionTagRepository.Queryable().Where(questionTagExpression);
|
|
|
-
|
|
|
- var examTagExpression = queryRequest.GetExamTagExpression();
|
|
|
- var examTagTable = new ExamRepository<ExamTag>(_repository.UOW, _dataPermissionFilterBuilder, _serviceProvider).Queryable().Where(examTagExpression);
|
|
|
-
|
|
|
+ var questionKnowladgeExpression = queryRequest.GetQuestionKnowladgeExpression();
|
|
|
+ var questionKnowladgeTable = new ExamRepository<QuestionKnowladge>(_repository.UOW, _dataPermissionFilterBuilder, _serviceProvider).Queryable().Where(questionKnowladgeExpression);
|
|
|
|
|
|
- var queryable = questionTable.InnerJoin(questionTagTable, (s, d) => s.Id == d.QuestionId).InnerJoin(examTagTable, (f, s, t) => s.TagId == t.Id).Select((s, d, f) => new QuestionViewResponse
|
|
|
+ var queryable = questionTable.InnerJoin(questionKnowladgeTable, (q, k) => q.Id == k.QuestionId).Select((q, k) => new QuestionViewResponse
|
|
|
{
|
|
|
- DifficultyLevel = s.DifficultyLevel,
|
|
|
- FormalEnable = s.FormalEnable,
|
|
|
- SimulateEnable = s.SimulateEnable,
|
|
|
- SortIndex = s.SortIndex,
|
|
|
- Status = s.Status,
|
|
|
- Tag = f.Name
|
|
|
+ DifficultyLevel = q.DifficultyLevel,
|
|
|
+ Title = q.Title,
|
|
|
+ QuestionType = q.QuestionType,
|
|
|
+ Id= q.Id
|
|
|
});
|
|
|
|
|
|
var result = await queryable.ToListAsync();
|
|
@@ -155,9 +144,11 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public override async Task AddAsync(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ public override async Task<string> AddAsync(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- await base.AddAsync(actionRequest, cancellationToken);
|
|
|
+ var id = await base.AddAsync(actionRequest, cancellationToken);
|
|
|
+
|
|
|
+ ResolveQuestionId(actionRequest,id);
|
|
|
|
|
|
await AddQuestionTags(actionRequest, cancellationToken);
|
|
|
|
|
@@ -168,12 +159,16 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
await AddKnowladges(actionRequest, cancellationToken);
|
|
|
|
|
|
await AddSourcewares(actionRequest, cancellationToken);
|
|
|
+
|
|
|
+ return id;
|
|
|
}
|
|
|
|
|
|
- public override async Task UpdateAsync(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ public override async Task UpdateAsync(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await base.UpdateAsync(actionRequest, cancellationToken);
|
|
|
|
|
|
+ ResolveQuestionId(actionRequest, actionRequest.Id);
|
|
|
+
|
|
|
await ModifyQuestionTags(actionRequest, cancellationToken);
|
|
|
|
|
|
await ModifyQuestionOptions(actionRequest, cancellationToken);
|
|
@@ -227,24 +222,32 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
#endregion
|
|
|
|
|
|
#region private method
|
|
|
- private async Task AddQuestionTags(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+
|
|
|
+ private void ResolveQuestionId(AddQuestionDto actionRequest,string id)
|
|
|
{
|
|
|
- if (actionRequest.QuestionTagDtos == null) return;
|
|
|
+ actionRequest.QuestionKnowladgeDtos.ForEach(x => x.QuestionId = id);
|
|
|
|
|
|
- var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == OperationStatus.Add).ToList();
|
|
|
+ actionRequest.QuestionOptionsDtos.ForEach(x => x.QuestionId = id);
|
|
|
|
|
|
- var questionTags = _mapper.Map<List<QuestionTag>>(questionTagDtos);
|
|
|
+ actionRequest.QuestionSourcewareDtos.ForEach(x => x.QuestionId = id);
|
|
|
|
|
|
- questionTagDtos.InitRequest<QuestionTagDto, QuestionDto>(actionRequest);
|
|
|
+ actionRequest.QuestionTagDtos.ForEach(x => x.QuestionId = id);
|
|
|
+ }
|
|
|
|
|
|
- questionTags.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
+ private async Task AddQuestionTags(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (actionRequest.QuestionTagDtos == null) return;
|
|
|
|
|
|
- questionTags.ToInsert(questionTagDtos);
|
|
|
+ var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == EEOperationStatus.Add).ToList();
|
|
|
+
|
|
|
+ var questionTags = _mapper.Map<List<QuestionTag>>(questionTagDtos);
|
|
|
+
|
|
|
+ questionTags.ToInsert();
|
|
|
|
|
|
await _questionTagRepository.AddWithValidateAsync(questionTags, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- private async Task AddQuestionOptions(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task AddQuestionOptions(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionOptionsDtos == null) return;
|
|
|
|
|
@@ -252,19 +255,15 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
if (actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Essay || actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Blank)
|
|
|
return;
|
|
|
|
|
|
- var questionOptionseDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == OperationStatus.Add).ToList();
|
|
|
+ var questionOptionseDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == EEOperationStatus.Add).ToList();
|
|
|
|
|
|
var questionOptionses = _mapper.Map<List<QuestionOptions>>(questionOptionseDtos);
|
|
|
|
|
|
- questionOptionseDtos.InitRequest<QuestionOptionsDto,QuestionDto>(actionRequest);
|
|
|
-
|
|
|
- questionOptionses.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
-
|
|
|
- questionOptionses.ToInsert(questionOptionseDtos);
|
|
|
+ questionOptionses.ToInsert();
|
|
|
|
|
|
await _questionOptionRepository.AddWithValidateAsync(questionOptionses, cancellationToken);
|
|
|
}
|
|
|
- private async Task AddQuestionAnswer(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task AddQuestionAnswer(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionAnswerDto == null) return;
|
|
|
|
|
@@ -272,85 +271,74 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
if (actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Multi
|
|
|
|| actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Single
|
|
|
|| actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Judge) return;
|
|
|
- actionRequest.QuestionAnswerDto.InitRequest<QuestionAnswerDto, QuestionDto>(actionRequest);
|
|
|
var questionAnswer = _mapper.Map<QuestionAnswer>(actionRequest.QuestionAnswerDto);
|
|
|
- questionAnswer.QuestionId = actionRequest.Id;
|
|
|
|
|
|
- questionAnswer.ToInsert(actionRequest);
|
|
|
+ questionAnswer.ToInsert();
|
|
|
|
|
|
await _questionAnswerRepository.AddWithValidateAsync(questionAnswer, cancellationToken);
|
|
|
|
|
|
}
|
|
|
- private async Task AddSourcewares(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task AddSourcewares(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionSourcewareDtos == null) return;
|
|
|
|
|
|
- var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == OperationStatus.Add).ToList();
|
|
|
+ var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == EEOperationStatus.Add).ToList();
|
|
|
|
|
|
var questionSourcewares = _mapper.Map<List<QuestionSourceware>>(questionSourcewareDtos);
|
|
|
-
|
|
|
- questionSourcewareDtos.InitRequest<QuestionSourcewareDto, QuestionDto>(actionRequest);
|
|
|
-
|
|
|
- questionSourcewares.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
-
|
|
|
- questionSourcewares.ToInsert(questionSourcewareDtos);
|
|
|
+
|
|
|
+ questionSourcewares.ToInsert();
|
|
|
|
|
|
await _questionSourcewareRepository.AddWithValidateAsync(questionSourcewares, cancellationToken);
|
|
|
}
|
|
|
- private async Task AddKnowladges(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task AddKnowladges(AddQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionKnowladgeDtos == null) return;
|
|
|
|
|
|
- var questionKnoladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == OperationStatus.Add).ToList();
|
|
|
+ var questionKnoladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == EEOperationStatus.Add).ToList();
|
|
|
|
|
|
var questionKnowladges = _mapper.Map<List<QuestionKnowladge>>(questionKnoladgeDtos);
|
|
|
|
|
|
- questionKnoladgeDtos.InitRequest<QuestionKnowladgeDto, QuestionDto>(actionRequest);
|
|
|
-
|
|
|
- questionKnowladges.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
-
|
|
|
- questionKnowladges.ToInsert(questionKnoladgeDtos);
|
|
|
+ questionKnowladges.ToInsert();
|
|
|
|
|
|
await _questionKnowladgeRepository.AddWithValidateAsync(questionKnowladges, cancellationToken);
|
|
|
}
|
|
|
- private async Task UpdateSourcewares(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task UpdateSourcewares(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionSourcewareDtos == null) return;
|
|
|
|
|
|
- var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == OperationStatus.Update).ToList();
|
|
|
+ var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == EEOperationStatus.Update).ToList();
|
|
|
|
|
|
var ids = questionSourcewareDtos.Select(x => x.Id);
|
|
|
|
|
|
var questionSourcewares = await _questionSourcewareRepository.Queryable().Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
- questionSourcewares = _mapper.Map<List<QuestionSourcewareDto>,List<QuestionSourceware>>(questionSourcewareDtos,questionSourcewares);
|
|
|
-
|
|
|
+ questionSourcewares = _mapper.Map<List<UpdateQuestionSourcewareDto>,List<QuestionSourceware>>(questionSourcewareDtos,questionSourcewares);
|
|
|
|
|
|
questionSourcewares.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
|
|
|
- questionSourcewares.ToUpdate(questionSourcewareDtos);
|
|
|
+ questionSourcewares.ToUpdate();
|
|
|
|
|
|
await _questionSourcewareRepository.UpdateWithValidateAsync(questionSourcewares, cancellationToken);
|
|
|
}
|
|
|
- private async Task UpdateKnowladges(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task UpdateKnowladges(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionKnowladgeDtos == null) return;
|
|
|
|
|
|
- var questionKnowladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == OperationStatus.Add).ToList();
|
|
|
+ var questionKnowladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == EEOperationStatus.Add).ToList();
|
|
|
|
|
|
var ids = questionKnowladgeDtos.Select(x => x.Id);
|
|
|
|
|
|
var questionKnowladges = await _questionKnowladgeRepository.Queryable().Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
- questionKnowladges = _mapper.Map<List<QuestionKnowladgeDto>, List<QuestionKnowladge>>(questionKnowladgeDtos,questionKnowladges);
|
|
|
+ questionKnowladges = _mapper.Map<List<UpdateQuestionKnowladgeDto>, List<QuestionKnowladge>>(questionKnowladgeDtos,questionKnowladges);
|
|
|
|
|
|
questionKnowladges.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
|
|
|
- questionKnowladges.ToUpdate(questionKnowladgeDtos);
|
|
|
+ questionKnowladges.ToUpdate();
|
|
|
|
|
|
await _questionKnowladgeRepository.UpdateWithValidateAsync(questionKnowladges, cancellationToken);
|
|
|
}
|
|
|
- private async Task UpdateQuestionAnswer(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task UpdateQuestionAnswer(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionAnswerDto == null) return;
|
|
|
|
|
@@ -359,17 +347,15 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
|| actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Single
|
|
|
|| actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Judge) return;
|
|
|
|
|
|
- actionRequest.QuestionAnswerDto.InitRequest<QuestionAnswerDto, QuestionDto>(actionRequest);
|
|
|
-
|
|
|
var questionAnswer = _mapper.Map<QuestionAnswer>(actionRequest.QuestionAnswerDto);
|
|
|
|
|
|
questionAnswer.QuestionId = actionRequest.Id;
|
|
|
|
|
|
- questionAnswer.ToUpdate(actionRequest);
|
|
|
+ questionAnswer.ToUpdate();
|
|
|
|
|
|
await _questionAnswerRepository.UpdateWithValidateAsync(questionAnswer, cancellationToken);
|
|
|
}
|
|
|
- private async Task UpdateQuestionOptions(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task UpdateQuestionOptions(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionOptionsDtos == null) return;
|
|
|
|
|
@@ -377,7 +363,7 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
if (actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Essay || actionRequest.QuestionType == Share.Enums.Exams.EQuestionType.Blank)
|
|
|
return;
|
|
|
|
|
|
- var questionOptionsDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == OperationStatus.Update).ToList();
|
|
|
+ var questionOptionsDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == EEOperationStatus.Update).ToList();
|
|
|
|
|
|
var ids = questionOptionsDtos.Select(x => x.Id);
|
|
|
|
|
@@ -387,36 +373,31 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
foreach(var questionOptionsDto in questionOptionsDtos)
|
|
|
{
|
|
|
var entity = questionOptionses.FirstOrDefault(x => x.Id == questionOptionsDto.Id);
|
|
|
- entitys.Add(_mapper.Map<QuestionOptionsDto, QuestionOptions>(questionOptionsDto, entity));
|
|
|
+ entitys.Add(_mapper.Map<UpdateQuestionOptionsDto, QuestionOptions>(questionOptionsDto, entity));
|
|
|
}
|
|
|
|
|
|
//questionOptionses = _mapper.Map<List<QuestionOptionsDto>, List<QuestionOptions>>(questionOptionsDtos,questionOptionses);
|
|
|
|
|
|
entitys.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
|
|
|
- questionOptionsDtos.InitRequest(actionRequest);
|
|
|
-
|
|
|
- entitys.ToUpdate(questionOptionsDtos);
|
|
|
+ entitys.ToUpdate();
|
|
|
|
|
|
await _questionOptionRepository.UpdateWithValidateAsync(entitys, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- private async Task UpdateQuestionTags(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task UpdateQuestionTags(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (actionRequest.QuestionTagDtos == null) return;
|
|
|
|
|
|
- var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == OperationStatus.Update).ToList();
|
|
|
+ var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == EEOperationStatus.Update).ToList();
|
|
|
|
|
|
var ids = questionTagDtos.Select(x => x.Id);
|
|
|
|
|
|
var questionTags = await _questionTagRepository.Queryable().Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
|
- questionTags = _mapper.Map<List<QuestionTagDto>, List<QuestionTag>>(questionTagDtos,questionTags);
|
|
|
-
|
|
|
-
|
|
|
- questionTags.ForEach(x => x.QuestionId = actionRequest.Id);
|
|
|
+ questionTags = _mapper.Map<List<UpdateQuestionTagDto>, List<QuestionTag>>(questionTagDtos,questionTags);
|
|
|
|
|
|
- questionTags.ToUpdate(questionTagDtos);
|
|
|
+ questionTags.ToUpdate();
|
|
|
|
|
|
await _questionTagRepository.UpdateWithValidateAsync(questionTags, cancellationToken);
|
|
|
}
|
|
@@ -440,39 +421,39 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
{
|
|
|
await _questionTagRepository.DeleteWithValidateAsync(entityQueryRequest, cancellationToken);
|
|
|
}
|
|
|
- private async Task ModifySourcewares(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task ModifySourcewares(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await AddSourcewares(actionRequest, cancellationToken);
|
|
|
|
|
|
await UpdateSourcewares(actionRequest, cancellationToken);
|
|
|
|
|
|
- var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == OperationStatus.Delete);
|
|
|
+ var questionSourcewareDtos = actionRequest.QuestionSourcewareDtos.Where(x => x.OperationStatus == EEOperationStatus.Delete);
|
|
|
var ids = questionSourcewareDtos.Select(m => m.Id);
|
|
|
EntityQueryRequest entityQueryRequest = ResovleDelete<QuestionSourceware>(ids);
|
|
|
|
|
|
await DeleteSourcewares(entityQueryRequest, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- private async Task ModifyKnowladges(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task ModifyKnowladges(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await AddKnowladges(actionRequest, cancellationToken);
|
|
|
|
|
|
await UpdateKnowladges(actionRequest, cancellationToken);
|
|
|
|
|
|
- var questionKnowladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == OperationStatus.Delete);
|
|
|
+ var questionKnowladgeDtos = actionRequest.QuestionKnowladgeDtos.Where(x => x.OperationStatus == EEOperationStatus.Delete);
|
|
|
var ids = questionKnowladgeDtos.Select(m => m.Id);
|
|
|
EntityQueryRequest entityQueryRequest = ResovleDelete<QuestionKnowladge>(ids);
|
|
|
|
|
|
await DeleteKnowladges(entityQueryRequest, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- private async Task ModifyQuestionAnswer(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task ModifyQuestionAnswer(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await AddQuestionAnswer(actionRequest, cancellationToken);
|
|
|
|
|
|
await UpdateQuestionAnswer(actionRequest, cancellationToken);
|
|
|
|
|
|
- if (actionRequest.QuestionAnswerDto != null && actionRequest.QuestionAnswerDto.OperationStatus == OperationStatus.Delete)
|
|
|
+ if (actionRequest.QuestionAnswerDto != null && actionRequest.QuestionAnswerDto.OperationStatus == EEOperationStatus.Delete)
|
|
|
{
|
|
|
var entityQueryRequest = new EntityQueryRequest
|
|
|
{
|
|
@@ -484,26 +465,26 @@ namespace Hotline.Application.Exam.Service.Questions
|
|
|
|
|
|
}
|
|
|
|
|
|
- private async Task ModifyQuestionOptions(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task ModifyQuestionOptions(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await AddQuestionOptions(actionRequest, cancellationToken);
|
|
|
|
|
|
await UpdateQuestionOptions(actionRequest, cancellationToken);
|
|
|
|
|
|
- var questionOptionsDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == OperationStatus.Delete);
|
|
|
+ var questionOptionsDtos = actionRequest.QuestionOptionsDtos.Where(x => x.OperationStatus == EEOperationStatus.Delete);
|
|
|
var ids = questionOptionsDtos.Select(m => m.Id);
|
|
|
EntityQueryRequest entityQueryRequest = ResovleDelete<QuestionOptions>(ids);
|
|
|
|
|
|
await DeleteQuestionOptions(entityQueryRequest, cancellationToken);
|
|
|
}
|
|
|
|
|
|
- private async Task ModifyQuestionTags(QuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
+ private async Task ModifyQuestionTags(UpdateQuestionDto actionRequest, CancellationToken cancellationToken)
|
|
|
{
|
|
|
await AddQuestionTags(actionRequest, cancellationToken);
|
|
|
|
|
|
await UpdateQuestionTags(actionRequest, cancellationToken);
|
|
|
|
|
|
- var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == OperationStatus.Delete);
|
|
|
+ var questionTagDtos = actionRequest.QuestionTagDtos.Where(x => x.OperationStatus == EEOperationStatus.Delete);
|
|
|
var ids = questionTagDtos.Select(m => m.Id);
|
|
|
EntityQueryRequest entityQueryRequest = ResovleDelete<QuestionTag>(ids);
|
|
|
|