add views

This commit is contained in:
Zakharov_Rostislav 2024-05-03 10:59:33 +04:00
parent 1f8d65b6a1
commit cdff9cd481
9 changed files with 235 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using CarShowroomDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace CarShowroomContracts.AbstractModels
{
internal interface ISale
internal interface ISale : IId
{
DateTime SaleTime { get; }
int Cost { get; }

View File

@ -0,0 +1,30 @@
using CarShowroomContracts.AbstractModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomDataModels.Dtos
{
internal class SaleDto : ISale
{
public int Id { get; set; }
public DateTime SaleTime { get; set; }
public int Cost { get; set; }
public int ClientId { get; set; }
public int EmployeeId { get; set; }
public List<int> CarIds { get; set; } = new();
public List<int> ServiseIds { get; set; } = new();
public SaleDto(ISale model)
{
Id = model.Id;
SaleTime = model.SaleTime;
Cost = model.Cost;
ClientId = model.ClientId;
EmployeeId = model.EmployeeId;
CarIds = model.CarIds;
ServiseIds = model.ServiseIds;
}
}
}

View File

@ -0,0 +1,32 @@
using CarShowroomContracts.AbstractModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class CarView : ICar
{
[DisplayName("Номер машины")]
public int Id { get; set; }
[DisplayName("Цвет")]
public string Color { get; set; }
[DisplayName("Дата производства")]
public DateTime RealiseDate { get; set; }
public int ModelId { get; set; }
[DisplayName("Модель")]
public string ModelName { get; set; } = string.Empty;
[DisplayName("Марка")]
public string MakeName { get; set; } = string.Empty;
public CarView(ICar model)
{
Id = model.Id;
Color = model.Color;
RealiseDate = model.RealiseDate;
ModelId = model.ModelId;
}
}
}

View File

@ -0,0 +1,28 @@
using CarShowroomDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class ClientView : IClient
{
public int Id { get; set; }
[DisplayName("ФИО")]
public string Name { get; set; }
[DisplayName("Email")]
public string Email { get; set; }
[DisplayName("Пароль")]
public string Password { get; set; }
public ClientView(IClient model)
{
Id = model.Id;
Name = model.Name;
Email = model.Email;
Password = model.Password;
}
}
}

View File

@ -0,0 +1,28 @@
using CarShowroomDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class EmployeeView : IEmployee
{
public int Id { get; set; }
[DisplayName("ФИО")]
public string Name { get; set; }
[DisplayName("Email")]
public string Email { get; set; }
[DisplayName("Пароль")]
public string Password { get; set; }
public EmployeeView(IEmployee model)
{
Id = model.Id;
Name = model.Name;
Email = model.Email;
Password = model.Password;
}
}
}

View File

@ -0,0 +1,22 @@
using CarShowroomContracts.AbstractModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class MakeView : IMake
{
public int Id { get; set; }
[DisplayName("Название марки")]
public string Name { get; set; }
public MakeView(IMake model)
{
Id = model.Id;
Name = model.Name;
}
}
}

View File

@ -0,0 +1,29 @@
using CarShowroomContracts.AbstractModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class ModelView : IModel
{
public int Id { get; set; }
[DisplayName("Модель")]
public string Name { get; set; }
[DisplayName("Цена")]
public int Price { get; set; }
public int MakeId { get; set; }
[DisplayName("Марка")]
public string MakeName { get; set; } = string.Empty;
public ModelView(IModel model)
{
Id = model.Id;
Name = model.Name;
Price = model.Price;
MakeId = model.MakeId;
}
}
}

View File

@ -0,0 +1,41 @@
using CarShowroomContracts.AbstractModels;
using CarShowroomContracts.Dtos;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomDataModels.Dtos
{
internal 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<int> CarIds { get; set; } = new();
public List<CarView> Cars { get; set; } = new();
public List<int> ServiseIds { get; set; } = new();
public List<ServiceView> Servises { get; set; } = new();
public SaleView(ISale model)
{
Id = model.Id;
SaleTime = model.SaleTime;
Cost = model.Cost;
ClientId = model.ClientId;
EmployeeId = model.EmployeeId;
CarIds = model.CarIds;
ServiseIds = model.ServiseIds;
}
}
}

View File

@ -0,0 +1,22 @@
using CarShowroomContracts.AbstractModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarShowroomContracts.Dtos
{
public class ServiceView : IService
{
public int Id { get; set; }
public string Name { get; set; }
public int Cost { get; set; }
public ServiceView(IService model)
{
Id = model.Id;
Name = model.Name;
Cost = model.Cost;
}
}
}