public static AlertProviderRegRespObj DeleteAlertProvider(DeleteAlertProviderObj regObj, string username)
        {
            var response = new AlertProviderRegRespObj
            {
                Status = new APIResponseStatus
                {
                    IsSuccessful = false,
                    Message      = new APIResponseMessage(),
                },
            };

            try
            {
                var apiResponse = new APIHelper(APIEndpoints.DELETE_ALERT_PROVIDER_ENDPOINT, username, Method.POST).ProcessAPI <DeleteAlertProviderObj, AlertProviderRegRespObj>(regObj, out var msg);
                if (msg.Code == 0 && string.IsNullOrEmpty(msg.TechMessage) && string.IsNullOrEmpty(msg.Message))
                {
                    return(apiResponse);
                }

                response.Status.Message.FriendlyMessage  = msg.Message;
                response.Status.Message.TechnicalMessage = msg.TechMessage;
                return(response);
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.GetBaseException().Message);
                response.Status.Message.FriendlyMessage  = "Error Occurred! Please try again later";
                response.Status.Message.TechnicalMessage = "Error: " + ex.GetBaseException().Message;
                return(response);
            }
        }
        public JsonResult ProcessDeleteRequest(int id)
        {
            try
            {
                var userData = MvcApplication.GetUserData(User.Identity.Name) ?? new UserData();

                if (userData.UserId < 1)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = false }));
                }

                if (id < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Invalid / Empty Selection" }));
                }
                var previousAlertProviderList = Session["_AlertProviderList_"] as List <AlertProviderObj>;
                if (previousAlertProviderList == null)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = true }));
                }

                var thisItem = previousAlertProviderList.Find(m => m.AlertProviderId == id);
                if (thisItem == null || thisItem.AlertProviderId < 1)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = "Selected item does not exist in the collection" }));
                }

                var passObj = new DeleteAlertProviderObj
                {
                    AdminUserId     = userData.UserId,
                    AlertProviderId = id
                };

                var response = AlertProviderService.DeleteAlertProvider(passObj, User.Identity.Name);
                if (!response.Status.IsSuccessful)
                {
                    return(Json(new { IsAuthenticated = true, IsSuccessful = false, Error = response.Status.Message.FriendlyMessage }));
                }

                Session["_AlertProviderList_"] = null;
                return(Json(new { IsAuthenticated = true, IsSuccessful = true, Error = "" }));
            }
            catch (Exception ex)
            {
                UtilTools.LogE(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new { IsAuthenticated = true, IsSuccessful = false, IsReload = false, Error = "Process Error Occurred! Please try again later" }));
            }
        }