55 lines
1.5 KiB
C#
55 lines
1.5 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.room
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class DeleteRoomIPController : Controller
|
|
{
|
|
Competition.Mysql.BLL.admin_ip ip_bll = new Competition.Mysql.BLL.admin_ip();
|
|
|
|
public DeleteRoomIPController()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除考场IP数据接口
|
|
/// </summary>
|
|
/// <param name="Id">考场IPid</param>
|
|
/// <returns></returns>
|
|
[Authorize]
|
|
[HttpGet]
|
|
[APIFilter]
|
|
public JsonResult Index(string Id)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(Id))
|
|
{
|
|
return Json(Tool.GetJsonWithCode(APICode.Fail, "考场IP的id不能为空"));
|
|
}
|
|
|
|
var ret = ip_bll.Delete(Id);
|
|
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, "发生错误,请联系管理员。"));
|
|
}
|
|
}
|
|
}
|
|
}
|