This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleModel.vb
58 lines (53 loc) · 1.77 KB
/
SimpleModel.vb
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Imports Microsoft.VisualBasic
Imports DevExpress.Web
Imports DevExpress.Web.Mvc
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.Web
Imports System.Web.Mvc
Namespace T299944.Models
Public Class SimpleModel
Private privateName As String
<Display(Name := "Name:"), Required(ErrorMessage := "Name is required"), RegularExpression("(\S)+", ErrorMessage := "White space is not allowed"), Remote("CheckUserName", "Home", ErrorMessage := "Name cannot be 'admin'")> _
Public Property Name() As String
Get
Return privateName
End Get
Set(ByVal value As String)
privateName = value
End Set
End Property
Private privateEmail As String
<Display(Name := "Email:"), Required(ErrorMessage := "Email is required"), RegularExpression("\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage := "Email is invalid")> _
Public Property Email() As String
Get
Return privateEmail
End Get
Set(ByVal value As String)
privateEmail = value
End Set
End Property
Private privatePhone As String
<Display(Name := "Phone:"), Mask("+1 (999) 000-0000", IncludeLiterals := MaskIncludeLiteralsMode.DecimalSymbol, PromptChar := "_"c, ErrorMessage := "Phone number is invalid")> _
Public Property Phone() As String
Get
Return privatePhone
End Get
Set(ByVal value As String)
privatePhone = value
End Set
End Property
Private privateAge? As Integer
<Display(Name := "Age:"), Required(ErrorMessage := "Age is required"), Range(18, 100, ErrorMessage := "Must be between 18 and 100")> _
Public Property Age() As Integer?
Get
Return privateAge
End Get
Set(ByVal value? As Integer)
privateAge = value
End Set
End Property
End Class
End Namespace