using System.ComponentModel.DataAnnotations; namespace AsbCloudApp.Data { #nullable enable /// /// DTO пользователя платформы /// public class UserDto : IId { /// public int Id { get; set; } /// /// логин /// [Required] [StringLength(255, MinimumLength = 2)] public string Login { get; set; } = null!; /// /// Имя /// public string? Name { get; set; } /// /// Фамилия /// public string? Surname { get; set; } /// /// Отчество /// public string? Patronymic { get; set; } /// /// Email /// [Required] [StringLength(255, MinimumLength = 6)] public string Email { get; set; } = null!; /// /// Phone /// public string? Phone { get; set; } /// /// Должность /// public string? Position { get; set; } /// /// Id компании /// [Required] public int IdCompany { get; set; } /// /// Id состояния пользователя /// public short? IdState { get; set; } /// /// DTO компании /// public CompanyDto? Company { get; set; } /// /// Получение отображаемого имени /// /// public string MakeDisplayName() { if (string.IsNullOrEmpty(Surname)) return Login; var s = Surname; if (!string.IsNullOrEmpty(Name)) { s += $"{Name[0]}."; if (!string.IsNullOrEmpty(Patronymic)) s += $" {Patronymic[0]}."; } return s; } } }