-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayerForm.cs
61 lines (51 loc) · 2.89 KB
/
PlayerForm.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
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
59
60
61
using RaceTo21_Blazor.Shared;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace RaceTo21_Blazor
{
//the model for editform
public class PlayerForm
{
//the variable bind in editform that use PlayerForm model
public int? Num { get; set; } = 2;
//if the field is empty
[Required(ErrorMessage = "Name is required")]
//charachters num should not bigger than 20 smaller than 1
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
//the component that I wrote in the app to check invalid name and show error in editform
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
//the variable bind in the editform that use PlayerForm model and for checking error
public string Name1 { get; set; }
//don't know how to use a array for the names
//public string[] Name { get; set; } = new string[8];
//public List<string> NameL = new();
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name2 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name3 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name4 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name5 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name6 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name7 { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(20, MinimumLength = 1, ErrorMessage = "Amount of characters must between 1 to 20.")]
[PlayerNameValidation(ErrorMessage = "Name has been taken")]
public string Name8 { get; set; }
}
}