backend/ExamKing.WebApp.Student/ApiControllers/ExamController.cs

(开头部分) 6KB

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

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

namespace ExamKing.WebApp.Student
{
    /// <summary>
    /// 考试接口
    /// </summary>
    public class ExamController : ApiControllerBase
    {
        private readonly IExamService _examService;
        private readonly IQuestionService _questionService;
        private readonly IStuanswerdetailService _stuanswerdetailService;
        private readonly ISelectService _selectService;
        private readonly IJudgeService _judgeService;
        private readonly IStuscoreService _stuscoreService;
        
        /// <summary>
        /// 依赖注入 
        /// </summary>
        public ExamController(
            IExamService examService,
            IQuestionService questionService,
            IStuanswerdetailService stuanswerdetailService,
            ISelectService selectService,
            IJudgeService judgeService,
            IStuscoreService stuscoreService)
        {
            _examService = examService;
            _questionService = questionService;
            _stuanswerdetailService = stuanswerdetailService;
            _selectService = selectService;
            _judgeService = judgeService;
            _stuscoreService = stuscoreService;
        }

        /// <summary>
        /// 查询正在考试列表
        /// </summary>
        /// <returns></returns>
        public async Task<PagedList<ExamQuestionOutput>> GetExamOnlineList(
            [FromQuery] int pageIndex = 1,
            [FromQuery] int pageSize = 10)
        {
            var student = await GetStudent();
            var exams = await _examService.FindExamOnlineByClassesAndPage(
                student.ClassesId,
                pageIndex,
                pageSize);
            return exams.Adapt<PagedList<ExamQuestionOutput>>();
        }
        
        /// <summary>
        /// 查询未考试列表
后面还有 134 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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