public String GetApplicationVersionInHeader(HttpActionContext actionContext)
        {
            try
            {
                if (actionContext == null ||
                    actionContext.Request == null ||
                    actionContext.Request.Headers == null)
                {
                    return("");
                }

                var header = actionContext.Request.Headers;
                if (!header.Contains("version"))
                {
                    return("NULL");
                }

                var result = "";
                var index  = 0;
                foreach (var str in header.GetValues("version"))
                {
                    result  = (index > 0 ? ";" : "");
                    result += str;
                }
                return(result);
            }
            catch (Exception ex)
            {
                ThisAppApi.AddException(ex);
                return("");
            }
        }
        private bool?ImproveBusinessRuleAndBugs(ref HttpActionContext actionContext)
        {
            try
            {
                if (actionContext != null &&
                    actionContext.Request != null &&
                    actionContext.Request.RequestUri != null &&
                    actionContext.Request.RequestUri.LocalPath.ToLower() == "/api/v1/card/initcardtransfer".ToLower())
                {
                    #region Remove bug of 'api/v1/card/initcardtransfer' in IOS v  1.08.02 and LESS

                    if (ThisAppApi.ApiTokenData == null ||
                        ThisAppApi.ApiTokenData.DeviceData == null)
                    {
                        return(false);
                    }

                    if (ThisAppApi.ApiTokenData.DeviceData.PlatFormCode == ClientPlatFormCoreEnum.IOS)
                    {
                        if (GetApplicationVersionNumberInHeader(actionContext) == 10802)
                        {
                            var iosUrl = ThisAppApi.GetSystemConfig(ConfigGroupEnum.AppSettings, AppSettingsNameEnum.iOsDownloadLink.ToString(), "/Download/ios_sepehrcard_bsi_vip");

                            actionContext.Response = new HttpResponseMessage(HttpStatusCode.OK)
                            {
                                ReasonPhrase   = "OK",
                                Content        = new ObjectContent <BaseResponse <RedirectResponse> >(new BaseResponse <RedirectResponse>(ServerAnswerEnum.Redirect, new RedirectResponse("کاربر گرامی؛برای استفاده از سرویس کارت به کارت لطفاً برنامه خود را بروزرسانی کنید", iosUrl)), new JsonMediaTypeFormatter(), "application/json"),
                                RequestMessage = actionContext.Request,
                            };
                            return(true);
                        }
                        else if (GetApplicationVersionNumberInHeader(actionContext) < 10802)
                        {
                            actionContext.Response = new HttpResponseMessage(HttpStatusCode.OK)
                            {
                                ReasonPhrase   = "OK",
                                Content        = new ObjectContent <BaseResponse <string> >(new BaseResponse <string>(new Exception("کاربر گرامی؛برای استفاده از سرویس کارت به کارت لطفاً برنامه خود را بروزرسانی کنید")), new JsonMediaTypeFormatter(), "application/json"),
                                RequestMessage = actionContext.Request,
                            };
                            return(true);
                        }
                    }
                    #endregion
                }

                return(false);
            }
            catch (Exception ex)
            {
                ThisAppApi.AddException(ex);
                return(null);
            }
        }
        public int GetApplicationVersionNumberInHeader(HttpActionContext actionContext)
        {
            try
            {
                var versionCode = 0;
                if (int.TryParse(GetApplicationVersionInHeader(actionContext).Replace(".", ""), out versionCode))
                {
                    return(versionCode);
                }

                return(0);
            }
            catch (Exception ex)
            {
                ThisAppApi.AddException(ex);
                return(0);
            }
        }