Beispiel #1
0
        public static void PlaceBooking(Booking booking)
        {
            DataAnnotationsValidationRunner validationRunner = new DataAnnotationsValidationRunner();
            IEnumerable <ValidationResult>  errors           = validationRunner.Validate(booking);

            if (errors.Any())
            {
                throw new ValidationException(errors.GetErrorMessage());
            }
        }
Beispiel #2
0
        public static void LogOn(User user)
        {
            DataAnnotationsValidationRunner validationRunner = new DataAnnotationsValidationRunner();
            IEnumerable <ValidationResult>  errors           = validationRunner.Validate(user);

            if (errors.Any())
            {
                throw new ValidationException(errors.GetErrorMessage());
            }

            // perform logon
        }