blob: 43365dce6adbde5bee7d36b74e72c4f8e3d1aa24 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 | using System;
namespace Timeline.Models.Validation
{
    public class NicknameValidator : Validator<string>
    {
        protected override (bool, string) DoValidate(string value)
        {
            if (value.Length > 25)
                return (false, Resource.NicknameTooLong);
            return (true, GetSuccessMessage());
        }
    }
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
    public class NicknameAttribute : ValidateWithAttribute
    {
        public NicknameAttribute() : base(typeof(NicknameValidator))
        {
        }
    }
}
 |