Repository navigation
Expand file tree
/
Copy pathEmployeeRequest.cs
More file actions
62 lines (49 loc) · 1.73 KB
/
Copy pathEmployeeRequest.cs
File metadata and controls
62 lines (49 loc) · 1.73 KB
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
using System;
using System.Text.Json.Serialization;
namespace RequiredNullableDemo.Models
{
public class EmployeeRequest
{
private int? departmentId = null;
private string? firstName = null;
private string? lastName = null;
private DateTime? dateOfBirth = null;
public int DepartmentId
{
get => this.departmentId ??
throw new InvalidOperationException(
$"The value of {nameof(this.DepartmentId)} is not set.");
set => this.departmentId = value;
}
[JsonIgnore]
public bool IsDepartmentIdSet => this.departmentId.HasValue;
public string FirstName
{
get => this.firstName ??
throw new InvalidOperationException(
$"The value of {nameof(this.FirstName)} is not set.");
set => this.firstName = value;
}
[JsonIgnore]
public bool IsFirstNameSet => this.firstName != null;
public string LastName
{
get => this.lastName ??
throw new InvalidOperationException(
$"The value of {nameof(this.LastName)} is not set.");
set => this.lastName = value;
}
[JsonIgnore]
public bool IsLastNameSet => this.lastName != null;
public DateTime DateOfBirth
{
get => this.dateOfBirth ??
throw new InvalidOperationException(
$"The value of {nameof(this.DateOfBirth)} is not set.");
set => this.dateOfBirth = value;
}
[JsonIgnore]
public bool IsDateOfBirthSet => this.dateOfBirth.HasValue;
public DateTime? DateOfDeath { get; set; }
}
}