56 lines
1.2 KiB
C#

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Employee
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Surname { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Phone { get; 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
};
}
}