2024-07-23 21:32:13 +04:00
|
|
|
|
|
2024-07-24 13:22:05 +04:00
|
|
|
|
using BeautySalonContracts.BindingModels;
|
|
|
|
|
using BeautySalonContracts.ViewModels;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
2024-07-23 21:32:13 +04:00
|
|
|
|
namespace BeautySalonDatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class Client
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
2024-07-24 21:04:21 +03:00
|
|
|
|
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;
|
2024-07-24 13:22:05 +04:00
|
|
|
|
|
2024-07-24 21:04:21 +03:00
|
|
|
|
public static Client? Create(ClientBindingModel model)
|
2024-07-24 13:22:05 +04:00
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new Client
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Name = model.Name,
|
|
|
|
|
Surname = model.Surname,
|
|
|
|
|
Login = model.Login,
|
|
|
|
|
Password = model.Password,
|
|
|
|
|
Phone = model.Phone,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void Update(ClientBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Name = model.Name;
|
|
|
|
|
Surname = model.Surname;
|
|
|
|
|
Login = model.Login;
|
|
|
|
|
Password = model.Password;
|
|
|
|
|
Phone = model.Phone;
|
|
|
|
|
}
|
|
|
|
|
public ClientViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
Name = Name,
|
|
|
|
|
Surname = Surname,
|
|
|
|
|
Login = Login,
|
|
|
|
|
Password = Password,
|
|
|
|
|
Phone = Phone
|
|
|
|
|
};
|
2024-07-23 21:32:13 +04:00
|
|
|
|
}
|
|
|
|
|
}
|