diff options
Diffstat (limited to 'Models/Classes/User.cs')
| -rw-r--r-- | Models/Classes/User.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Models/Classes/User.cs b/Models/Classes/User.cs index c40a69a..e5a83d6 100644 --- a/Models/Classes/User.cs +++ b/Models/Classes/User.cs @@ -72,9 +72,10 @@ namespace Models.Classes throw new ArgumentException($"{name} length cannot be less than {minLength} and more than {maxLength}."); foreach (char character in value) // more efficient than Linq - { - if (!Char.IsLetter(character) || (canBeDigit && !Char.IsDigit(character))) - throw new ArgumentException($"{name} contains invalid characters."); + { + if (!Char.IsLetter(character)) + if (!(Char.IsDigit(character) && canBeDigit)) + throw new ArgumentException($"{name} contains invalid characters."); } } |
