Eliseev_E.E._PIbd-21_DBMS/TransportCompany/TransportCompanyDatabaseImplements/Models/Client.cs

59 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.ViewModels;
using TransportCompanyDataModels.Models;
namespace TransportCompanyDatabaseImplements.Models;
public partial class Client : IClientModel
{
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>();
public static Client Create(ClientBindingModel model)
{
return new Client()
{
Id = model.Id,
Name = model.Name,
Surname = model.Surname,
Patronymic = model.Patronymic,
Telephone = model.Telephone,
Email = model.Email,
};
}
public void Update(ClientBindingModel model)
{
Id = model.Id;
Name = model.Name;
Surname = model.Surname;
Patronymic = model.Patronymic;
Telephone = model.Telephone;
Email = model.Email;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Surname = Surname,
Patronymic = Patronymic,
Telephone = Telephone,
Email = Email
};
}