Ejemplo n.º 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());
            }
        }
Ejemplo n.º 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
        }