public static AlertProviderItemRegRespObj DeleteAlertProviderItem(DeleteAlertProviderItemObj regObj, string username)
        {
            var response = new AlertProviderItemRegRespObj
            {
                Status = new APIResponseStatus
                {
                    IsSuccessful = false,
                    Message      = new APIResponseMessage(),
                },
            };

            try
            {
                var apiResponse = new APIHelper(APIEndpoints.DELETE_ALERT_PROVIDER_ITEM_ENDPOINT, username, Method.POST).ProcessAPI <DeleteAlertProviderItemObj, AlertProviderItemRegRespObj>(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 previousAlertProviderItemList = Session["_AlertProviderItemList_"] as List <AlertProviderItemObj>;
                if (previousAlertProviderItemList == null)
                {
                    return(Json(new { IsSuccessful = false, Error = "Your session has expired", IsAuthenticated = true }));
                }

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

                var passObj = new DeleteAlertProviderItemObj
                {
                    AdminUserId         = userData.UserId,
                    AlertProviderItemId = id
                };

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

                Session["_AlertProviderItemList_" + id] = 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" }));
            }
        }