public async Task <IActionResult> OnGetAsync(int id = 0)
        {
            if (id < 0)
            {
                return(Redirect(UrlSetting.NotFoundUrl));
            }
            if (id == 0)
            {
                IPAddress = new DbSysIpAllowlist();

                ViewData["Title"] = "新增IP白名单";
            }
            else
            {
                IPAddress = await _adminSecurityApplication.GetIpWhiteById(id);

                if (IPAddress == null)
                {
                    return(Redirect(UrlSetting.NotFoundUrl));
                }

                ViewData["Title"] = "新增IP白名单";
            }
            return(Page());
        }
        public async Task <bool> AddIpAllow(Req <IpAddressEditDto> request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (request.Data == null)
            {
                throw new ArgumentException("Data is null");
            }

            var db = new DbSysIpAllowlist()
            {
                AddingTime    = DateTime.Now,
                AddingAdminId = request.OperatorId,
                ModifyTime    = DateTime.Now,
                ModifyAdminId = request.OperatorId,
                Name          = request.Data.Name,
                Ip            = request.Data.Ip,
                IsDisable     = request.Data.IsDisable,
            };
            var helper = GetWriteHelper();
            await helper.Insert_Async(db);

            await ResetIpFilter();

            return(true);
        }