public bool PostNewIPRule(IPRule rule) { userContext.VerifyPermission(PermissionToken.ManageIPRules); if (string.IsNullOrEmpty(rule?.Address)) { throw new HttpResponseException(System.Net.HttpStatusCode.BadRequest); } bool result = false; repo.HandleTransaction(ctx => { result = ipRuleManager.AddPermBannedIP(ctx, rule); ctx.AuditLogger.SysLog($"added {rule.Address} to banned IPs"); }); return(result); }
public ActionResult <bool> PostNewIPRule(IPRule rule) { _userContext.VerifyPermission(PermissionToken.ManageIPRules); if (string.IsNullOrEmpty(rule?.Address)) { return(BadRequest()); } bool result = false; _repo.HandleTransaction(ctx => { result = _ipRuleManager.AddPermBannedIP(ctx, rule); ctx.AuditLogger.SysLog($"added {rule.Address} to banned IPs"); }); return(result); }