backend/ExamKing.WebApp.Teacher/Controllers/QuestionController.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Collections.Generic;
using System.Threading.Tasks;
using ExamKing.Application.Mappers;
using ExamKing.Application.Services;
using Mapster;
using Microsoft.AspNetCore.Mvc;

namespace ExamKing.WebApp.Teacher
{
    /// <summary>
    /// 题库接口
    /// </summary>
    public class QuestionController : ApiControllerBase
    {
        private readonly ISelectService _selectService;
        private readonly IJudgeService _judgeService;
        /// <summary>
        /// 依赖注入 
        /// </summary>
        public QuestionController(
            IJudgeService judgeService,
            ISelectService selectService)
        {
            _selectService = selectService;
            _judgeService = judgeService;
        }

        /// <summary>
        /// 创建选择题
        /// </summary>
        /// <param name="addSelectInput"></param>
        /// <returns></returns>
        public async Task<SelectOutput> InsertAddSelect(AddSelectInput addSelectInput)
        {
            var teacher = await GetTeacher();
            var selectDto = addSelectInput.Adapt<SelectDto>();
            selectDto.TeacherId = teacher.Id;
            var selectInsert = await _selectService.CreateSelect(selectDto);
            return selectInsert.Adapt<SelectOutput>();
        }

        /// <summary>
        /// 更新选择题
        /// </summary>
        /// <param name="editSelectInput"></param>
        /// <returns></returns>
        public async Task<SelectOutput> UpdateEditSelect(EditSelectInput editSelectInput)
        {
            var teacher = await GetTeacher();
            var edit = editSelectInput.Adapt<SelectDto>();
            edit.TeacherId = teacher.Id;
            var selectUpdate = await _selectService.UpdateSelect(edit);
            return selectUpdate.Adapt<SelectOutput>();
        }

        /// <summary>
        /// 删除选择题
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
后面还有 122 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。