Inheritance: GeneralResponse
        public async Task <IActionResult> EditModalAsync(Guid uid)
        {
            if (uid == Guid.Empty)
            {
                return(Json(new { message = $"{GlobalConstants.ERROR_ACTION_PREFIX} find {ENTITY_NAME}" }));
            }

            BlacklistResponse _Response = await __BlacklistManager.GetByUIDAsync(uid);

            if (_Response == null)
            {
                return(Json(new { error = $"{GlobalConstants.ERROR_ACTION_PREFIX} find {ENTITY_NAME}" }));
            }

            UpdateViewModel _Model = new UpdateViewModel
            {
                Email  = _Response.Email,
                Reason = _Response.Reason,
                Type   = _Response.Type,
                UID    = _Response.UID,
                Active = _Response.Active
            };

            return(PartialView("_EditModal", _Model));
        }
        public async Task <IActionResult> DeleteModalAsync(Guid uid)
        {
            if (uid == Guid.Empty)
            {
                return(Json(new { message = $"{GlobalConstants.ERROR_ACTION_PREFIX} find {ENTITY_NAME}" }));
            }

            BlacklistResponse _Blacklist = await __BlacklistManager.GetByUIDAsync(uid);

            if (_Blacklist == null)
            {
                return(Json(new { message = $"{GlobalConstants.ERROR_ACTION_PREFIX} delete {ENTITY_NAME}" }));
            }

            return(PartialView("_DeleteModal", __Mapper.Map <DeleteViewModel>(_Blacklist)));
        }
        public async Task <IActionResult> CreateAsync(CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_CreateModal", model));
            }

            BlacklistResponse _Response = await __BlacklistManager.CreateAsync(__Mapper.Map <CreateBlacklistRequest>(model));

            if (!_Response.Success)
            {
                return(Json(new { message = $"{GlobalConstants.ERROR_ACTION_PREFIX} create {ENTITY_NAME}" }));
            }

            return(Json(new { success = $"{GlobalConstants.SUCCESS_ACTION_PREFIX} created {ENTITY_NAME}." }));
        }
        void context_BeginRequest(object source, EventArgs e)
        {
            HttpApplication app = (HttpApplication)source;

            if (app.Request.Url.AbsolutePath == BlacklistConfig.GetConfig().BlockedUrl) return;
            if (BlacklistResponse.HasCookie()) return;

            BlacklistResponse response = null;
            if (BlacklistConfig.GetConfig().TestMode)
                response = BlacklistResponse.Test();
            else
                response = new BlacklistResponse(app.Request.ServerVariables[BlacklistConfig.GetConfig().IPHeader]);

            if (response.VisitorType == VisitorTypes.Unknown) return;
            if (BlacklistConfig.GetConfig().IgnoreSearchEngines && response.VisitorType == VisitorTypes.SearchEngine) return;
            if (response.ThreatScore <= BlacklistConfig.GetConfig().Threshold) return;

            app.Response.Redirect(BlacklistConfig.GetConfig().BlockedUrl + response.ToQueryString() + "&l=" + app.Request.Url.ToString());
        }
        public async Task <IActionResult> EditAsync(UpdateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_EditModal", model));
            }

            BlacklistResponse _Blacklist = await __BlacklistManager.GetByUIDAsync(model.UID);

            if (_Blacklist == null)
            {
                return(Json(new { error = $"{GlobalConstants.ERROR_ACTION_PREFIX} find {ENTITY_NAME}." }));
            }

            BaseResponse _Response = await __BlacklistManager.UpdateAsync(__Mapper.Map <UpdateBlacklistRequest>(model));

            if (_Response == null)
            {
                return(Json(new { error = $"{GlobalConstants.ERROR_ACTION_PREFIX} update {ENTITY_NAME}." }));
            }

            return(Json(new { success = $"{GlobalConstants.SUCCESS_ACTION_PREFIX} update {ENTITY_NAME}." }));
        }