public JsonResult GetAddress(string id, string id2)
        {
            var apiNumber = id2;

            var error = new List<ResultForPostCode>();

            if (User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "address");

                if (res == false)
                {
                    error.Add(new ResultForPostCode { PostCode = "You do not have enough credits remain" });
                    return Json(error, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "address");

                if (tUser == false)
                {
                    error.Add(new ResultForPostCode { PostCode = "You have reach your free daily limits!" });
                    return Json(error, JsonRequestBehavior.AllowGet);
                }
            }
            var dataCleansing = new DataCleansing.DataCleansingLogich();
            var temp = dataCleansing.Cleansing(id);
            return Json(temp, JsonRequestBehavior.AllowGet);
        }
        public JsonResult EmailValidation(string id, string id2)
        {
            var apiNumber = id2;

            if (User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "email");

                if (res == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "email");

                if (tUser == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(410, JsonRequestBehavior.AllowGet);
                }
            }

            var tmpResilts = new Helpers.Email();
            var tmpResult = tmpResilts.Validate(id);

            return Json(tmpResult, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetCard(string id, string id2)
        {
            var apiNumber = id2;

            if(User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "email");

                if (res == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "card");

                if (tUser == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(410, JsonRequestBehavior.AllowGet);
                }
            }

            var cardType = new CardType();
            var result = cardType.CardLogic(id);

            return Json(result, JsonRequestBehavior.AllowGet);
        }
        public JsonResult BicValidation(string id, string id2)
        {
            var apiNumber = id2;
            if (User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "bic");

                if (res == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "email");

                if (tUser == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(410, JsonRequestBehavior.AllowGet);
                }
            }

            using (var context = new ApplicationDbContext())
            {
                var result = context.Database.SqlQuery<data_validation.net.Web.Models.BicInfoModel>("GetFullDetailsSwift @SwiftCode", new SqlParameter("SwiftCode", id)).ToList();
                return Json(result, JsonRequestBehavior.AllowGet);
            }
        }
        public JsonResult IbanValidation(string id, string id2)
        {
            string apiNumber = id2;

            if (User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "iban");

                if (res == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "iban");

                if (tUser == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(410, JsonRequestBehavior.AllowGet);
                }
            }

            var resT = new BankValidationController();

            var temp = BankValidationController.Iban.CheckIban(id, true);

            var error = new List<iBanBicModel>();

            if (temp.IsValid == false)
            {
                error.Add(new iBanBicModel { BankName = temp.Message, BranchName = id });

                return Json(error, JsonRequestBehavior.AllowGet);
            }

            var result = resT.BicCountry(id.ToUpper());

            return Json(result, JsonRequestBehavior.AllowGet);
        }
        public JsonResult CardValidation(string id, string id2)
        {
            var res = new List<CardValidationViewModel>();

            try
            {
                string number = id.Replace(" ", "");
                long intNumber = Int64.Parse(number);
            }
            catch
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return Json(403, JsonRequestBehavior.AllowGet);
            }

            if(User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var isValid = helper.IsValid(User.Identity.Name, 6, id, "single", "card");

                if (isValid == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                string apiNumber = id2;
                var isValid = new IsValid();
                bool tUser = isValid.ValidUser(apiNumber, id, "address");

                if (tUser == false)
                {
                    res.Add(new CardValidationViewModel { Message = "You have reach your free daily limits!" });
                    return Json(res, JsonRequestBehavior.AllowGet);
                }

            }
            var cardType = new CardType();
            var result = cardType.CardLogic(id);

            return Json(result, JsonRequestBehavior.AllowGet);
        }
        public JsonResult TelephoneValidation(string id, string id2)
        {
            var apiNumber = id2;

            if (User.Identity.IsAuthenticated)
            {
                var helper = new Helpers.CreditsDeduct();
                var res = helper.IsValid(User.Identity.Name, 6, id, "single", "email");

                if (res == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(404, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                var isValid = new IsValid();

                bool tUser = isValid.ValidUser(apiNumber, id, "email");

                if (tUser == false)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(410, JsonRequestBehavior.AllowGet);
                }
            }

            var removeSpecialCharacters = new RemoveSpecialCharacters();

            var number = removeSpecialCharacters.RemoveCharactersTelephone(id);

            var result = new List<PhoneValidationViewModel>();

            if (number.Length != 11 && number.Length != 10)
            {
                result.Add(new PhoneValidationViewModel
                {
                    IsValid = "Phone is invalid",
                    Number = id
                });

                return Json(result, JsonRequestBehavior.AllowGet);
            }

            using (var context = new ApplicationDbContext())
            {
                for (int i = 5; i >= 2; i--)
                {

                    var tmpData = context.Database.SqlQuery<GetPhoneArea_Result>("GetPhoneArea2 @code", new SqlParameter("code", number.Substring(0, i))).First();

                    if (tmpData.IsValid == "Valid")
                    {
                        result.Add(new PhoneValidationViewModel
                        {
                            Area = tmpData.AreaCovered,
                            Number = id,
                            IsValid = tmpData.IsValid
                        });
                        return Json(result, JsonRequestBehavior.AllowGet);
                    }
                }
            }
            result.Add(new PhoneValidationViewModel
            {

                IsValid = "Phone seems invalid"
            });

            return Json(result, JsonRequestBehavior.AllowGet);
        }