-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.cs
68 lines (61 loc) · 1.56 KB
/
User.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
62
63
64
65
66
67
68
namespace UsersModel
{
using System;
using System.Text.Json.Serialization;
public class User : IUser
{
private string name;
private Role role;
private string pwd;
public User(string name, string pwd, Role role)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException($"\"{nameof(name)}\" не может быть неопределенным или пустым.", nameof(name));
}
if (string.IsNullOrEmpty(pwd))
{
throw new ArgumentException($"\"{nameof(pwd)}\" не может быть неопределенным или пустым.", nameof(pwd));
}
this.name = name;
this.role = role;
this.pwd = pwd;
}
[JsonPropertyName("login")]
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
[JsonPropertyName("role")]
public Role Role
{
get
{
return role;
}
set
{
role = value;
}
}
[JsonPropertyName("password")]
public string Pwd
{
get
{
return pwd;
}
set
{
pwd = value;
}
}
}
}