2023-04-13 00:10:37 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using TransportCompanyContracts.BindingModels;
|
|
|
|
|
using TransportCompanyContracts.ViewModels;
|
|
|
|
|
|
|
|
|
|
namespace TransportCompanyDatabaseImplements.Models;
|
|
|
|
|
|
2023-04-13 15:32:45 +04:00
|
|
|
|
public partial class Client
|
2023-04-13 00:10:37 +04:00
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public string Surname { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public string Patronymic { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public string Telephone { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public string Email { get; set; } = null!;
|
|
|
|
|
|
|
|
|
|
public virtual ICollection<Trucking> Truckings { get; set; } = new List<Trucking>();
|
|
|
|
|
|
2023-04-13 00:49:02 +04:00
|
|
|
|
public static Client Create(ClientBindingModel model)
|
2023-04-13 00:10:37 +04:00
|
|
|
|
{
|
|
|
|
|
return new Client()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Name = model.Name,
|
|
|
|
|
Surname = model.Surname,
|
|
|
|
|
Patronymic = model.Patronymic,
|
2023-04-13 00:49:02 +04:00
|
|
|
|
Telephone = model.Telephone,
|
2023-04-13 00:10:37 +04:00
|
|
|
|
Email = model.Email,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(ClientBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id;
|
|
|
|
|
Name = model.Name;
|
|
|
|
|
Surname = model.Surname;
|
|
|
|
|
Patronymic = model.Patronymic;
|
2023-04-13 00:49:02 +04:00
|
|
|
|
Telephone = model.Telephone;
|
2023-04-13 00:10:37 +04:00
|
|
|
|
Email = model.Email;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ClientViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
Name = Name,
|
|
|
|
|
Surname = Surname,
|
|
|
|
|
Patronymic = Patronymic,
|
2023-04-13 00:49:02 +04:00
|
|
|
|
Telephone = Telephone,
|
2023-04-13 00:10:37 +04:00
|
|
|
|
Email = Email
|
|
|
|
|
};
|
|
|
|
|
}
|