示例#1
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            LinkShareDbEntities db = new LinkShareDbEntities();
            string userEmailValue  = value.ToString();
            int    count           = db.AppUsers.Where(x => x.AppUserEmail == userEmailValue).ToList().Count;

            if (count != 0)
            {
                return(new ValidationResult("User Already Exist With This Email ID"));
            }

            return(ValidationResult.Success);
        }
示例#2
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            LinkShareDbEntities db = new LinkShareDbEntities();
            string urlValue        = value.ToString();
            int    count           = db.Urls.Where(x => x.UrlLink == urlValue).ToList().Count;

            if (count != 0)
            {
                return(new ValidationResult("Url Already Exist"));
            }

            return(ValidationResult.Success);
        }