using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using SushiBarDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SushiBarDatabaseImplement.Models { public class Cook : ICookModel { public int Id { get; set; } [Required] public string CookName { get; set; } = string.Empty; [Required] public string CookSurname { get; set; } = string.Empty; public int Experience { get; set; } [Required] public string PhoneNumber { get; set; } = string.Empty; [Required] public string Passport { get; set; } = string.Empty; public static Cook? Create(CookBindingModel model) { if (model == null) return null; return new Cook() { Id = model.Id, CookName = model.CookName, CookSurname = model.CookSurname, Experience = model.Experience, PhoneNumber = model.PhoneNumber, Passport = model.Passport }; } public void Update(CookBindingModel model) { if (model == null) return; CookName = model.CookName; CookSurname = model.CookSurname; Experience = model.Experience; PhoneNumber = model.PhoneNumber; Passport = model.Passport; } public CookViewModel GetViewModel => new() { Id = Id, CookName = CookName, CookSurname = CookSurname, Experience = Experience, PhoneNumber = PhoneNumber, Passport = Passport }; } }