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

61 lines
2.0 KiB
C#

using ProjectGSM.Entities.Enums;
using System.ComponentModel;
namespace ProjectGSM.Entities;
public class Advocate
{
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 int Experience { get; private set; }
[DisplayName("Выполненные задачи")] public int CompletedTasks { get; private set; }
[DisplayName("Рейтинг")] public int Rating { 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 LicenseType LicenseType { get; private set; }
[DisplayName("Дата создания")] public DateTime CreatedAt { get; private set; } = DateTime.UtcNow;
// Конструктор для создания сущности
public static Advocate CreateEntity(
int id,
string name,
bool sex,
DateTime dateOfBirth,
int experience,
int completedTasks,
int rating,
string email,
string phoneNumber,
string address, LicenseType license)
{
return new Advocate
{
Id = id,
Name = name ?? string.Empty,
Sex = sex,
DateOfBirth = dateOfBirth,
Experience = experience,
CompletedTasks = completedTasks,
Rating = rating,
Email = email ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Address = address ?? string.Empty,
LicenseType = license,
CreatedAt = DateTime.UtcNow
};
}
}