1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using Exam.Application.Interface.Exam;
- using Exam.Application.Interface.TestPapers;
- using Exam.Infrastructure.Data.Entity;
- using Exam.Share.ViewResponses.Exam;
- using Exam.Share.ViewResponses.TestPaper;
- using Hotline.Application.Exam.Constants.ApiRoutes;
- using Hotline.Share.Dtos.TestPapers;
- using Hotline.Share.Requests.Exam;
- using Hotline.Share.ViewResponses.Exam;
- using Microsoft.AspNetCore.Mvc;
- namespace Hotline.Api.Controllers.Exam
- {
- public class TestPaperController : BaseController
- {
- private readonly ITestPaperService _testPaperService;
- public TestPaperController(ITestPaperService testPaperService)
- {
- _testPaperService = testPaperService;
- }
- /// <summary>
- /// 新增试卷
- /// </summary>
- /// <param name="extractRuleDto"></param>
- /// <returns></returns>
- [HttpPost(TestPaperApiRoute.Add)]
- public async Task Add([FromBody] AddTestPaperDto extractRuleDto)
- {
- await _testPaperService.AddAsync(extractRuleDto, HttpContext.RequestAborted);
- }
- /// <summary>
- /// 修改试卷
- /// </summary>
- /// <param name="extractRuleDto"></param>
- /// <returns></returns>
- [HttpPut(TestPaperApiRoute.Update)]
- public async Task Update([FromBody] UpdateTestPaperDto extractRuleDto)
- {
- await _testPaperService.UpdateAsync(extractRuleDto, HttpContext.RequestAborted);
- }
- /// <summary>
- /// 删除试卷
- /// </summary>
- /// <param name="entityQueryRequest"></param>
- /// <returns></returns>
- [HttpDelete(TestPaperApiRoute.Delete)]
- public async Task Delete(EntityQueryRequest entityQueryRequest)
- {
- await _testPaperService.DeleteAsync(entityQueryRequest, HttpContext.RequestAborted);
- }
- /// <summary>
- /// 获取课件分页列表
- /// </summary>
- /// <param name="sourcewarePagedRequest"></param>
- /// <returns></returns>
- [HttpPost(TestPaperApiRoute.GetPagedList)]
- public async Task<TestPaperPageViewResponse> GetPagedList([FromBody] TestPaperPagedRequest sourcewarePagedRequest)
- {
- var sourcewarePageViewResponse = await _testPaperService.GetPagedListAsync(sourcewarePagedRequest);
- return sourcewarePageViewResponse as TestPaperPageViewResponse;
- }
- /// <summary>
- /// 获取课件分类
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet(TestPaperApiRoute.Get)]
- public async Task<TestPaperDto> Get(string id)
- {
- var extractRuleDto = await _testPaperService.GetAsync(new EntityQueryRequest
- {
- Id = id
- });
- return extractRuleDto;
- }
- /// <summary>
- /// 获取课件分页列表
- /// </summary>
- /// <returns></returns>
- [HttpGet(TestPaperApiRoute.Count)]
- public async Task<List<TestPaperQuestionCountViewResponse>> GetPagedList([FromQuery] TestPaperQuestionCountRequest testPaperQuestionCountRequest)
- {
- var testPaperQuestionCountViewResponses = await _testPaperService.GetTestPaperQuestionCount(testPaperQuestionCountRequest);
- return testPaperQuestionCountViewResponses;
- }
- }
- }
|