50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using SecuritySystemContracts.BindingModels;
|
|
using SecuritySystemContracts.ViewModels;
|
|
using SecuritySystemDataModels.Models;
|
|
|
|
namespace SecuritySystemListImplement.Models
|
|
{
|
|
public class Client : IClientModel
|
|
{
|
|
public string ClientFIO { get; private set; } = string.Empty;
|
|
|
|
public string Email { get; private set; } = string.Empty;
|
|
|
|
public string Password { get; private set; } = string.Empty;
|
|
|
|
public int Id { get; private set; }
|
|
|
|
public static Client? Create(ClientBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new Client()
|
|
{
|
|
Id = model.Id,
|
|
Email = model.Email,
|
|
Password = model.Password,
|
|
ClientFIO = model.ClientFIO
|
|
};
|
|
}
|
|
public void Update(ClientBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
Email = model.Email;
|
|
Password = model.Password;
|
|
ClientFIO = model.ClientFIO;
|
|
}
|
|
public ClientViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
Email = Email,
|
|
Password = Password,
|
|
ClientFIO = ClientFIO
|
|
};
|
|
}
|
|
}
|