Ejemplo n.º 1
0
        public static void InsertValidation(UserInputModel createUserRequest)
        {
            var validationException = new ValidationException();

            validationException.AddValidation(() => !createUserRequest.Password.Equals(createUserRequest.PasswordConfirmation), PasswordConfirmationKey, PasswordConfirmationMessage);
            validationException.ThrowIfHasError();
        }
Ejemplo n.º 2
0
        public static void UpdateValidaton(UserInputModel updateUserRequest)
        {
            var validationException = new ValidationException();

            validationException.AddValidation(() => !updateUserRequest.Password.Equals(updateUserRequest.PasswordConfirmation), PasswordConfirmationKey, PasswordConfirmationMessage);
            validationException.AddValidation(() => string.IsNullOrWhiteSpace(updateUserRequest.Id), MissingIdKey, MissingIdMessage);
            validationException.ThrowIfHasError();
        }
Ejemplo n.º 3
0
        public static void Validate(this ClientInputModel inputModel)
        {
            var validationException = new ValidationException();

            validationException.AddValidation(() => inputModel.AllowedGrantTypes.IsNullOrEmpty(), nameof(inputModel.AllowedGrantTypes), ALLOWED_GRANT_TYPES_VALIDATION_MESSAGE);
            validationException.AddValidation(() => string.IsNullOrWhiteSpace(inputModel.ClientName), nameof(inputModel.ClientName), CLIENT_NAME_VALIDATION_MESSAGE);
            validationException.AddValidation(() => string.IsNullOrWhiteSpace(inputModel.ClientId), nameof(inputModel.ClientId), CLIENT_ID_VALIDATION_MESSAGE);

            validationException.ThrowIfHasError();
        }