コード例 #1
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            BuyNSell_DbEntities objDB = new BuyNSell_DbEntities();

            if (value != null)
            {
                String EmailId = value.ToString();

                UserMaster CheckEmailId = objDB.UserMasters.Where(e => e.EmailId.Equals(EmailId)).FirstOrDefault();

                if (CheckEmailId != null)
                {
                    return(new ValidationResult("EmailId Already Exist"));
                }
                else
                {
                    return(ValidationResult.Success);
                }
            }

            return(null);
        }