From af78799f28fa88925f0d9290c27f4b26aa577354 Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Fri, 3 May 2024 10:27:07 +0400 Subject: [PATCH] add Dtos --- .../AbstractModels/ISale.cs | 4 +++- .../CarShowroomContracts.csproj | 4 ---- .../CarShowroomDataModels/Dtos/CarDto.cs | 24 +++++++++++++++++++ .../CarShowroomDataModels/Dtos/ClientDto.cs | 24 +++++++++++++++++++ .../CarShowroomDataModels/Dtos/EmployeeDto.cs | 24 +++++++++++++++++++ .../CarShowroomDataModels/Dtos/MakeDto.cs | 20 ++++++++++++++++ .../CarShowroomDataModels/Dtos/ModeDto.cs | 24 +++++++++++++++++++ .../CarShowroomDataModels/Dtos/ServiceDto.cs | 22 +++++++++++++++++ 8 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/CarDto.cs create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/ClientDto.cs create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/EmployeeDto.cs create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/MakeDto.cs create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/ModeDto.cs create mode 100644 CarShowroom/CarShowroomDataModels/Dtos/ServiceDto.cs diff --git a/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs b/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs index 43fdd59..af0945e 100644 --- a/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs +++ b/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs @@ -12,5 +12,7 @@ namespace CarShowroomContracts.AbstractModels int Cost { get; } int ClientId { get; } int EmployeeId { get; } - } + List CarIds { get; } + List ServiseIds { get; } + } } diff --git a/CarShowroom/CarShowroomDataModels/CarShowroomContracts.csproj b/CarShowroom/CarShowroomDataModels/CarShowroomContracts.csproj index 9b35c66..132c02c 100644 --- a/CarShowroom/CarShowroomDataModels/CarShowroomContracts.csproj +++ b/CarShowroom/CarShowroomDataModels/CarShowroomContracts.csproj @@ -6,8 +6,4 @@ enable - - - - diff --git a/CarShowroom/CarShowroomDataModels/Dtos/CarDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/CarDto.cs new file mode 100644 index 0000000..1c0422c --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/CarDto.cs @@ -0,0 +1,24 @@ +using CarShowroomContracts.AbstractModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomContracts.Dtos +{ + public class CarDto : ICar + { + public int Id { get; set; } + public string Color { get; set; } + public DateTime RealiseDate { get; set; } + public int ModelId { get; set; } + public CarDto(ICar model) + { + Id = model.Id; + Color = model.Color; + RealiseDate = model.RealiseDate; + ModelId = model.ModelId; + } + } +} diff --git a/CarShowroom/CarShowroomDataModels/Dtos/ClientDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/ClientDto.cs new file mode 100644 index 0000000..0584e8e --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/ClientDto.cs @@ -0,0 +1,24 @@ +using CarShowroomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomContracts.Dtos +{ + public class ClientDto : IClient + { + public int Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public ClientDto(IClient model) + { + Id = model.Id; + Name = model.Name; + Email = model.Email; + Password = model.Password; + } + } +} diff --git a/CarShowroom/CarShowroomDataModels/Dtos/EmployeeDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/EmployeeDto.cs new file mode 100644 index 0000000..d971a56 --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/EmployeeDto.cs @@ -0,0 +1,24 @@ +using CarShowroomDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomContracts.Dtos +{ + public class EmployeeDto : IEmployee + { + public int Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public EmployeeDto(IEmployee model) + { + Id = model.Id; + Name = model.Name; + Email = model.Email; + Password = model.Password; + } + } +} diff --git a/CarShowroom/CarShowroomDataModels/Dtos/MakeDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/MakeDto.cs new file mode 100644 index 0000000..52f6597 --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/MakeDto.cs @@ -0,0 +1,20 @@ +using CarShowroomContracts.AbstractModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomContracts.Dtos +{ + public class MakeDto : IMake + { + public int Id { get; set; } + public string Name { get; set; } + public MakeDto(IMake model) + { + Id = model.Id; + Name = model.Name; + } + } +} diff --git a/CarShowroom/CarShowroomDataModels/Dtos/ModeDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/ModeDto.cs new file mode 100644 index 0000000..2f65f73 --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/ModeDto.cs @@ -0,0 +1,24 @@ +using CarShowroomContracts.AbstractModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomContracts.Dtos +{ + public class ModeDto : IModel + { + public int Id { get; set; } + public string Name { get; set; } + public int Price { get; set; } + public int MakeId { get; set; } + public ModeDto(IModel model) + { + Id = model.Id; + Name = model.Name; + Price = model.Price; + MakeId = model.MakeId; + } + } +} diff --git a/CarShowroom/CarShowroomDataModels/Dtos/ServiceDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/ServiceDto.cs new file mode 100644 index 0000000..434b06a --- /dev/null +++ b/CarShowroom/CarShowroomDataModels/Dtos/ServiceDto.cs @@ -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 ServiceDto : IService + { + public int Id { get; set; } + public string Name { get; set; } + public int Cost { get; set; } + public ServiceDto(IService model) + { + Id = model.Id; + Name = model.Name; + Cost = model.Cost; + } + } +}