using BeautySalonContracts.BindingModels; using BeautySalonContracts.ViewModels; namespace BeautySalonDatabaseImplement.Models { internal class Employee { public int Id { get; private set; } public string Name { get; private set; } = string.Empty; public string Surname { get; private set; } = string.Empty; public string Login { get; private set; } = string.Empty; public string Password { get; private set; } = string.Empty; public string Phone { get; private set; } = string.Empty; public static Employee? Create(EmployeeBindingModel model) { if (model == null) { return null; } return new Employee { Id = model.Id, Name = model.Name, Surname = model.Surname, Login = model.Login, Password = model.Password, Phone = model.Phone, }; } public void Update(EmployeeBindingModel model) { if (model == null) { return; } Name = model.Name; Surname = model.Surname; Login = model.Login; Password = model.Password; Phone = model.Phone; } public EmployeeViewModel GetViewModel => new() { Id = Id, Name = Name, Surname = Surname, Login = Login, Password = Password, Phone = Phone }; } }