diff --git a/Controllers/SimApiBaseController.cs b/Controllers/SimApiBaseController.cs index 80ea814..e3137a0 100644 --- a/Controllers/SimApiBaseController.cs +++ b/Controllers/SimApiBaseController.cs @@ -50,7 +50,7 @@ public class SimApiBaseController : Controller } /// - /// 检测条件,根据条件返回报错 + /// 检测条件,根据条件返回报错 如果condition是ture报错 /// /// 检测条件 /// 错误代码 @@ -63,6 +63,30 @@ public class SimApiBaseController : Controller } } + + /// + /// 检测条件,根据条件返回报错 如果condition是ture报错 + /// + /// 检测条件 + /// 错误代码 + /// 错误描述 + protected static void ErrorWhenTrue(bool condition, int code = 500, string message = "") + { + ErrorWhen(condition, code, message); + } + + + /// + /// 如果condition是false 报错 + /// + /// + /// + /// + protected static void ErrorWhenFalse(bool condition, int code = 500, string message = "") + { + ErrorWhen(!condition, code, message); + } + /// /// 检测给定的变量是否为NUll ///