From 05ccb4d8f1bbe3fb64e117136b4a89bcfb0b0b33 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 27 Oct 2020 19:21:35 +0800 Subject: Split front and back end. --- .../Validation/GeneralTimelineNameValidator.cs | 33 ---------------------- 1 file changed, 33 deletions(-) delete mode 100644 Timeline/Models/Validation/GeneralTimelineNameValidator.cs (limited to 'Timeline/Models/Validation/GeneralTimelineNameValidator.cs') diff --git a/Timeline/Models/Validation/GeneralTimelineNameValidator.cs b/Timeline/Models/Validation/GeneralTimelineNameValidator.cs deleted file mode 100644 index e1c96fbd..00000000 --- a/Timeline/Models/Validation/GeneralTimelineNameValidator.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace Timeline.Models.Validation -{ - public class GeneralTimelineNameValidator : Validator - { - private readonly UsernameValidator _usernameValidator = new UsernameValidator(); - private readonly TimelineNameValidator _timelineNameValidator = new TimelineNameValidator(); - - protected override (bool, string) DoValidate(string value) - { - if (value.StartsWith('@')) - { - return _usernameValidator.Validate(value.Substring(1)); - } - else - { - return _timelineNameValidator.Validate(value); - } - } - } - - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, - AllowMultiple = false)] - public class GeneralTimelineNameAttribute : ValidateWithAttribute - { - public GeneralTimelineNameAttribute() - : base(typeof(GeneralTimelineNameValidator)) - { - - } - } -} -- cgit v1.2.3