using BeautySaloonContracts.BindingModels;
using BeautySaloonContracts.ViewModels;
using BeautySaloonDataModels;
namespace BeautySaloonDatabaseImplement;
///
/// Сущность клиенты
///
public partial class Client : IClientModel
{
///
/// Уникальный идентификатор
///
public int Id { get; set; }
///
/// Имя
///
public string Name { get; set; } = null!;
///
/// Фамилия
///
public string Surname { get; set; } = null!;
///
/// Отчество
///
public string? Patronymic { get; set; }
///
/// Номер телефона
///
public string Phone { get; set; } = null!;
public virtual ICollection Orders { get; } = new List();
public static Client Create(ClientBindingModel model)
{
return new Client()
{
Id = model.Id,
Name = model.Name,
Surname = model.Surname,
Patronymic = model.Patronymic,
Phone = model.Phone
};
}
public void Update(ClientBindingModel model)
{
Name = model.Name;
Surname = model.Surname;
Patronymic = model.Patronymic;
Phone = model.Phone;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Surname = Surname,
Patronymic = Patronymic,
Phone = Phone
};
}