CompetitionAPI_dotnet/CompetitionAPI/Controllers/back/DeleteExamRosterController.cs

57 lines
1.7 KiB
C#

using Competition.Common.Util;
using CompetitionAPI.api.back;
using CompetitionAPI.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Ocsp;
namespace CompetitionAPI.Controllers.back
{
[Route("api/[controller]")]
[ApiController]
public class DeleteExamRosterController : Controller
{
Competition.Mysql.BLL.pow_exam_users exam_user_bll = new Competition.Mysql.BLL.pow_exam_users();
public DeleteExamRosterController()
{
}
/// <summary>
/// 删除考试名单接口
/// </summary>
/// <param name="ExamUsersId">考试用户id</param>
/// <returns></returns>
[Authorize]
[HttpGet]
[APIFilter]
public JsonResult Index(string ExamUsersId)
{
try
{
if (string.IsNullOrEmpty(ExamUsersId))
{
return Json(Tool.GetJsonWithCode(APICode.Fail, "考试id不能为空"));
}
var ret = exam_user_bll.Delete(ExamUsersId);
if (ret)
{
return Json(Tool.GetJsonWithCode(APICode.Success, "删除成功"));
}
else
{
return Json(Tool.GetJsonWithCode(APICode.Fail, "删除失败"));
}
}
catch (Exception ex)
{
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
}
}
}
}