using SchoolContracts.BindingModel; using SchoolContracts.ViewModels; using SchoolDataModels.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 SchoolDatabaseImplement.Models { public class Employee : IEmployeeModel { public int Id { get; set; } [Required] public string EmployeePhone { get; set; } = string.Empty; [Required] public string EmployeeEmail { get; set; } = string.Empty; [Required] public string EmployeePassword { get; set; } = string.Empty; [Required] public string EmployeeName { get; set; } = string.Empty; [ForeignKey("EmployeeId")] public virtual List Lessons { get; set; } = new(); public static Employee? Create(EmployeeBindingModel model) { if (model == null) { return null; } return new() { Id = model.Id, EmployeeName = model.EmployeeName, EmployeeEmail = model.EmployeeEmail, EmployeePassword = model.EmployeePassword, EmployeePhone = model.EmployeePhone }; } public void Update(EmployeeBindingModel model) { if (model == null) { return; } EmployeeName = model.EmployeeName; EmployeeEmail = model.EmployeeEmail; EmployeePassword = model.EmployeePassword; EmployeePhone = model.EmployeePhone; } public ExpenseViewModel GetViewModel => new() { Id = Id, //TODO }; } }