-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserInfo.cs
28 lines (21 loc) · 895 Bytes
/
UserInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.ComponentModel.DataAnnotations;
namespace AttributeProject {
public class UserInfo {
[RegularExpression(@"^[a-zA-Z]{1,30}$", ErrorMessage ="FirstName must be alpha only and less than 30 chars")]
public string FirstName {set;get;}
[NoJson]
[Required]
[RegularExpression(@"^[a-zA-Z]{1,30}$", ErrorMessage ="LastName must be alpha only and less than 30 chars")]
public string LastName {set;get;}
[Required]
[EmailAddress]
public string EmailAddress {set;get;}
[Required]
[Phone]
[NoJson]
public string PhoneNumber {set;get;}
public override string ToString() {
return $"{nameof(FirstName)}: {FirstName}, {nameof(LastName)}: {LastName}, {nameof(EmailAddress)}: {EmailAddress}, {nameof(PhoneNumber)}: {PhoneNumber}";
}
}
}