aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/Validation/UsernameValidator.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-23 20:41:19 +0800
committer杨宇千 <crupest@outlook.com>2019-10-23 20:41:19 +0800
commit9a163719b76958374d1c27616393368e54e8b8a5 (patch)
treeb005aa3d8bc34d8e710ce7fae30236c62dcbe712 /Timeline/Models/Validation/UsernameValidator.cs
parent3ddb38839ac07de4edf071faeb753b62acb0bed1 (diff)
downloadtimeline-9a163719b76958374d1c27616393368e54e8b8a5.tar.gz
timeline-9a163719b76958374d1c27616393368e54e8b8a5.tar.bz2
timeline-9a163719b76958374d1c27616393368e54e8b8a5.zip
...
Diffstat (limited to 'Timeline/Models/Validation/UsernameValidator.cs')
-rw-r--r--Timeline/Models/Validation/UsernameValidator.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Timeline/Models/Validation/UsernameValidator.cs b/Timeline/Models/Validation/UsernameValidator.cs
index 65d4da71..dc237add 100644
--- a/Timeline/Models/Validation/UsernameValidator.cs
+++ b/Timeline/Models/Validation/UsernameValidator.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
namespace Timeline.Models.Validation
{
@@ -36,4 +37,15 @@ namespace Timeline.Models.Validation
return (true, SuccessMessageGenerator);
}
}
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
+ AllowMultiple = false)]
+ public class UsernameAttribute : ValidateWithAttribute
+ {
+ public UsernameAttribute()
+ : base(typeof(UsernameValidator))
+ {
+
+ }
+ }
}