using Microsoft.Identity.Client; using ServiceStationContracts.BindingModels; using ServiceStationContracts.ViewModels; using ServiceStationDataModels.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 ServiceStationsDataBaseImplement.Models { public class Executor : IExecutorModel { public int Id { get; set; } [Required] public string Email { get; set; } = string.Empty; [Required] public string Password { get; set; } = string.Empty; [Required] public string FIO { get; set; } = string.Empty; [ForeignKey("ExecutorId")] public virtual List Works { get; set; } = new(); public static Executor? Create(ExecutorBindingModel? model) { if (model == null) { return null; } return new Executor() { Id = model.Id, Email = model.Email, Password = model.Password, FIO = model.FIO }; } public void Update(ExecutorBindingModel? model) { if (model== null) { return; } Email = model.Email; Password = model.Password; FIO = model.FIO; } public ExecutorViewModel GetViewModel => new() { Id = Id, Email = Email, Password = Password, FIO = FIO }; } }