Beispiel #1
0
        public override IEnumerable <ErrorInfo> PerformComplexValidation()
        {
            List <ErrorInfo> errorList = new List <ErrorInfo>();

            if (DateOfBirth.Year == null ||
                DateOfBirth.Month == null ||
                DateOfBirth.Day == null ||
                !DateOfBirth.ToDateTime().Between(DateUtil.CurrentDateTime.AddYears(-99), DateUtil.CurrentDateTime.AddYears(-18)))
            {
                errorList.Add(new ErrorInfo("DateOfBirth", "Please enter a valid date of birth, You must be over the age of 18"));
            }

            return(errorList);
        }