SUBD_PIbd-23_ZakharovRA/CarShowroom/CarShowroomDataModels/Views/SaleView.cs

52 lines
1.5 KiB
C#

using CarShowroomContracts.AbstractModels;
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 Price { 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<int> CarIds
{
get
{
return Cars.Select(c => c.Id).ToList();
}
}
public List<CarView> Cars { get; set; } = new();
public List<int> ServiceIds
{
get
{
return Services.Select(s => s.Id).ToList();
}
}
public List<ServiceView> Services { get; set; } = new();
public SaleView(ISale model)
{
Id = model.Id;
SaleTime = model.SaleTime;
Price = model.Price;
ClientId = model.ClientId;
EmployeeId = model.EmployeeId;
}
public SaleView() { }
}
}