protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            int count = 0;

            if (CheckValidate.NotValidate)
            {
                if (count > 1)
                {
                    return(ValidationResult.Success);
                }
                CheckValidate.NotValidate = false;
                count++;
                return(ValidationResult.Success);
            }
            LinkHubDBEntities db = new LinkHubDBEntities();

            string useremail = value.ToString();

            if (db.tbl_User.Where(c => c.UserEmail == useremail).Count() != 0)
            {
                return(new ValidationResult("User Exists"));
            }

            return(ValidationResult.Success);
        }
Example #2
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            if (CheckValidate.NotValidate || count != 0)
            {
                CheckValidate.NotValidate = false;
                count++;
                return(ValidationResult.Success);
            }
            LinkHubDBEntities db = new LinkHubDBEntities();

            string url = value.ToString();

            if (db.tbl_Url.Where(c => c.Url == url).Count() != 0)
            {
                return(new ValidationResult("Url Exists"));
            }

            return(ValidationResult.Success);
        }