using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace SushiBarDatabaseImplement.Models { public class Cook { [Key] public int Id { get; set; } [Required] public string Fio { get; set; } = string.Empty; [Required] public DateTime EmploymentDate { get; set; } [ForeignKey("CookId")] public virtual List ChequeItems { get; set; } = new(); public static Cook? Create(CookBindingModel Model) { return new Cook() { Fio = Model.Fio, EmploymentDate = Model.EmploymentDate, }; } public void Update(CookBindingModel Model) { Fio = Model.Fio; } public CookViewModel ViewModel => new() { Id = Id, Fio = Fio, EmploymentDate = EmploymentDate, }; } }