Beispiel #1
0
        public bool Validate()
        {
            var item1IsValid = Item1.Validate();
            var item2IsValid = Item2.Validate();

            if (item1IsValid && item2IsValid)
            {
                Errors.Clear();

                IEnumerable <string> errors = Validations.Where(v => !v.Check(this))
                                              .Select(v => v.ValidationMessage);

                Errors        = errors.ToList();
                Item2.Errors  = Errors;
                Item2.IsValid = !Errors.Any();
            }

            IsValid = !Item1.Errors.Any() && !Item2.Errors.Any();

            return(this.IsValid);
        }