CompetitionAPI_dotnet/CompetitionAPI/Controllers/back/GetAllFaultListController.cs

42 lines
1.3 KiB
C#

using Competition.Common.Util;
using CompetitionAPI.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CompetitionAPI.Controllers.back
{
[Route("api/[controller]")]
[ApiController]
public class GetAllFaultListController : Controller
{
Competition.Mysql.BLL.pow_exam_fault exam_fault_bll = new Competition.Mysql.BLL.pow_exam_fault();
public GetAllFaultListController()
{
}
/// <summary>
/// 根据考试id或实训id获取所有故障数据接口
/// </summary>
/// <param name="ExamId">考试id</param>
/// <returns></returns>
[Authorize]
[HttpGet]
[APIFilter]
public JsonResult Index(string ExamId)
{
try
{
var fault_list = exam_fault_bll.GetModelList(" ExamId = '" + ExamId + "' order by CreateTime asc ");
return Json(Tool.GetJsonWithCode(APICode.Success, fault_list));
}
catch (Exception ex)
{
LogHelper.WriteLog(ex.Message + ",行号:" + ex.StackTrace);
return Json(Tool.GetJsonWithCode(APICode.Fail, "发生错误,请联系管理员。"));
}
}
}
}