using Contracts.BindingModels; using Contracts.ViewModels; using DataModels.Models; using System; using System.Collections.Generic; namespace DataBase; /// /// Таблица компаний-заказчиков /// public partial class Company : ICompany { /// /// Айди компании /// public int Id { get; set; } /// /// Наимнование компании /// public string Title { get; set; } = null!; /// /// Статус компании /// public int? StatusId { get; set; } public virtual Status? Status { get; set; } public virtual ICollection Voyages { get; set; } = new List(); public string StatusTitle { get; set; } = string.Empty; public static Company Create(LogisticContext context, CompanyBM model) { return new Company() { Id = model.Id, Title = model.Title, StatusId = model.StatusId, StatusTitle=model.StatusTitle }; } public void Update(CompanyBM model) { Title = model.Title; StatusTitle = model.StatusTitle; StatusId = model.StatusId; } public CompanyVM GetViewModel => new() { Id = Id, Title = Title, StatusId = StatusId, StatusTitle = StatusTitle }; }