public async Task <JsonResult> DelIpAddress(int ipid) { //删除时先判断服务器IP对应(ServerIp),端口映射(InPortOutPort)中是否有引用数据 int total = await serverRepo.GetServerIpCountByIpidAsync(ipid); if (total > 0) { return(Json(new { isOk = false, msg = "先删除服务器IP对应数据" })); } var count = await serverRepo.GetInPortOutPortCountByIpIDAsync(ipid); if (count > 0) { return(Json(new { isOk = false, msg = "先删除端口映射对应数据" })); } var result = await serverRepo.DelIpAddressAsync(ipid); return(Json(new { isOk = result, msg = "" })); }