using CarShowroomContracts.AbstractModels; using CarShowroomContracts.Dtos; using CarShowroomContracts.Views; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CarShowroomDataModels.Views { public class SaleView : ISale { [DisplayName("Номер продажи")] public int Id { get; set; } [DisplayName("Время")] public DateTime SaleTime { get; set; } [DisplayName("Сумма")] public int Cost { get; set; } public int? ClientId { get; set; } [DisplayName("Клиент")] public string ClientName { get; set; } = string.Empty; public int? EmployeeId { get; set; } [DisplayName("Сотрудник")] public string EmployeeName { get; set; } = string.Empty; public List CarIds { get { return Cars.Select(c => c.Id).ToList(); } } public List Cars { get; set; } = new(); public List ServiceIds { get { return Services.Select(s => s.Id).ToList(); } } public List Services { get; set; } = new(); public SaleView(ISale model) { Id = model.Id; SaleTime = model.SaleTime; Cost = model.Cost; ClientId = model.ClientId; EmployeeId = model.EmployeeId; } } }