PIBD14-Boyko-M.S.-GSM-Autot.../ProjectGSM/Entities/Client.cs
2024-12-17 01:21:56 +04:00

45 lines
1.4 KiB
C#

using System.ComponentModel;
namespace ProjectGSM.Entities;
public class Client
{
public int Id { get; private set; }
[DisplayName("Имя")] public string Name { get; private set; } = string.Empty;
[DisplayName("Пол")] public bool Sex { get; private set; }
[DisplayName("Дата рождения")] public DateTime DateOfBirth { get; private set; }
[DisplayName("Электронная почта")] public string Email { get; private set; } = string.Empty;
[DisplayName("Номер телефона")] public string PhoneNumber { get; private set; } = string.Empty;
[DisplayName("Адрес")] public string Address { get; private set; } = string.Empty;
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static Client CreateEntity(
int id,
string name,
bool sex,
DateTime dateOfBirth,
string email,
string phoneNumber,
string address)
{
return new Client
{
Id = id,
Name = name ?? string.Empty,
Sex = sex,
DateOfBirth = dateOfBirth,
Email = email ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Address = address ?? string.Empty,
CreatedAt = DateTime.UtcNow
};
}
}