using System; using System.Collections.Generic; using TaskTrackerContracts.BindingModels; using TaskTrackerContracts.ViewModels; namespace TaskTrackerDatabaseImplement; /// /// Сущность "Компания" /// public partial class Company { /// /// Идентификатор сущности "Компания" /// public int Id { get; set; } /// /// Название компании /// public string Name { get; set; } = null!; public string? Login { get; set; } public string? Password { get; set; } public virtual ICollection Employees { get; set; } = new List(); public virtual ICollection Projects { get; set; } = new List(); public static Company? Create(CompanyBindingModel model) { if (model == null) { return null; } return new Company() { Name = model.Name, Password = model.Password, Login = model.Login, Id = model.Id }; } public static Company Create(CompanyViewModel model) { return new Company() { Name = model.Name, Password = model.Password, Login = model.Login, Id = model.Id }; } public void Update(CompanyBindingModel model) { if (model == null) { return; } Name = model.Name; Password = model.Password; Login = model.Login; } public CompanyViewModel GetViewModel => new() { Name = Name, Password = Password, Login = Login, Id = Id }; }