44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using AlibabaCloud.SDK.Vod20170321.Models;
|
|
using Learn.Archives.API.Controllers.Dto;
|
|
using Learn.Archives.API.Expand;
|
|
using Learn.Archives.Core.Common;
|
|
using Learn.Archives.Core.Model;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Diagnostics;
|
|
using System.Security.Claims;
|
|
using UserCenter.Model;
|
|
|
|
namespace Learn.Archives.API.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 年级控制器
|
|
/// </summary>
|
|
public class ExamController : BackController<Exam>
|
|
{
|
|
readonly Repository<Exam> baseService;
|
|
readonly Repository<ExamClassInfo> examClassInfoService;
|
|
readonly Repository<ExamUserInfo> examUserInfoService;
|
|
readonly LiveUserInfo userInfo;
|
|
public ExamController(Repository<Exam> baseService, LiveUserInfo userInfo, Repository<ExamClassInfo> examClassInfoService, Repository<ExamUserInfo> examUserInfoService) : base(baseService)
|
|
{
|
|
this.baseService = baseService;
|
|
this.userInfo = userInfo;
|
|
this.examClassInfoService = examClassInfoService;
|
|
this.examUserInfoService = examUserInfoService;
|
|
}
|
|
|
|
public override async Task<bool> Del([FromBody] params long[] ids)
|
|
{
|
|
if (ids.Length > 1)
|
|
Oh.ModelError("同时只允许删除一场考试");
|
|
var id= ids.First();
|
|
var dCount = await examClassInfoService.AsDeleteable().Where(s => s.ExamId == id)
|
|
.ExecuteCommandAsync();
|
|
var dCount1 = await examUserInfoService.AsDeleteable().Where(s => s.ExamId == id)
|
|
.ExecuteCommandAsync();
|
|
return await base.Del(ids);
|
|
}
|
|
}
|
|
}
|