using ElectronicsShopContracts.BindingModels; using ElectronicsShopContracts.ViewModels; using ElectronicsShopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ElectronicsShopDataBaseImplement.Models { public class Client : IClientModel { public int ID { get; set; } [Required] public string ClientFIO { get; set; }=string.Empty; [Required] public string Password { get; set; } = string.Empty; [Required] public string Email { get; set; } = string.Empty; public static Client? Create(ClientBindingModel model) { if(model == null) { return null; } return new Client() { ID = model.ID, ClientFIO = model.ClientFIO, Password = model.Password, Email = model.Email }; } public void Update(ClientBindingModel model) { if (model == null) { return; } ClientFIO = model.ClientFIO; Password = model.Password; Email = model.Email; } public ClientViewModel GetViewModel => new() { ID = ID, ClientFIO = ClientFIO, Password = Password, Email = Email }; } }