From 34a61279d127b0fe7ef1a7ba96d9d4b84d6e48cc Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Fri, 3 May 2024 11:28:27 +0400 Subject: [PATCH] start Entities --- .../AbstractModels/ISale.cs | 4 +-- .../CarShowroomDataModels/Dtos/SaleDto.cs | 4 +-- .../CarShowroomDataModels/Views/SaleView.cs | 6 ++-- .../CarShowroomDatabaseStorage.csproj | 1 + .../Entities/Car.cs | 24 +++++++++++++++ .../Entities/Client.cs | 24 +++++++++++++++ .../Entities/Employee.cs | 24 +++++++++++++++ .../Entities/Make.cs | 20 +++++++++++++ .../Entities/Model.cs | 24 +++++++++++++++ .../Entities/Sale.cs | 30 +++++++++++++++++++ .../Entities/Service.cs | 22 ++++++++++++++ 11 files changed, 176 insertions(+), 7 deletions(-) create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Car.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Client.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Make.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Model.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs create mode 100644 CarShowroom/CarShowroomDatabaseStorage/Entities/Service.cs diff --git a/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs b/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs index fce93a2..03da69f 100644 --- a/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs +++ b/CarShowroom/CarShowroomDataModels/AbstractModels/ISale.cs @@ -7,13 +7,13 @@ using System.Threading.Tasks; namespace CarShowroomContracts.AbstractModels { - internal interface ISale : IId + public interface ISale : IId { DateTime SaleTime { get; } int Cost { get; } int ClientId { get; } int EmployeeId { get; } List CarIds { get; } - List ServiseIds { get; } + List ServiceIds { get; } } } diff --git a/CarShowroom/CarShowroomDataModels/Dtos/SaleDto.cs b/CarShowroom/CarShowroomDataModels/Dtos/SaleDto.cs index cb4e814..d11ae97 100644 --- a/CarShowroom/CarShowroomDataModels/Dtos/SaleDto.cs +++ b/CarShowroom/CarShowroomDataModels/Dtos/SaleDto.cs @@ -15,7 +15,7 @@ namespace CarShowroomDataModels.Dtos public int ClientId { get; set; } public int EmployeeId { get; set; } public List CarIds { get; set; } = new(); - public List ServiseIds { get; set; } = new(); + public List ServiceIds { get; set; } = new(); public SaleDto(ISale model) { Id = model.Id; @@ -24,7 +24,7 @@ namespace CarShowroomDataModels.Dtos ClientId = model.ClientId; EmployeeId = model.EmployeeId; CarIds = model.CarIds; - ServiseIds = model.ServiseIds; + ServiceIds = model.ServiceIds; } } } diff --git a/CarShowroom/CarShowroomDataModels/Views/SaleView.cs b/CarShowroom/CarShowroomDataModels/Views/SaleView.cs index f97c2b0..7cda64c 100644 --- a/CarShowroom/CarShowroomDataModels/Views/SaleView.cs +++ b/CarShowroom/CarShowroomDataModels/Views/SaleView.cs @@ -31,14 +31,14 @@ namespace CarShowroomDataModels.Dtos } } public List Cars { get; set; } = new(); - public List ServiseIds + public List ServiceIds { get { - return Servises.Select(s => s.Id).ToList(); + return Services.Select(s => s.Id).ToList(); } } - public List Servises { get; set; } = new(); + public List Services { get; set; } = new(); public SaleView(ISale model) { Id = model.Id; diff --git a/CarShowroom/CarShowroomDatabaseStorage/CarShowroomDatabaseStorage.csproj b/CarShowroom/CarShowroomDatabaseStorage/CarShowroomDatabaseStorage.csproj index 44ff353..c00b1c4 100644 --- a/CarShowroom/CarShowroomDatabaseStorage/CarShowroomDatabaseStorage.csproj +++ b/CarShowroom/CarShowroomDatabaseStorage/CarShowroomDatabaseStorage.csproj @@ -8,6 +8,7 @@ + diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Car.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Car.cs new file mode 100644 index 0000000..23e9249 --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Car.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 CarShowroomDatabaseStorage.Entities +{ + public class Car : ICar + { + public int Id { get; set; } + public string Color { get; set; } + public DateTime RealiseDate { get; set; } + public int ModelId { get; set; } + public Car(ICar car) + { + Id = car.Id; + Color = car.Color; + RealiseDate = DateTime.Now; + ModelId = car.ModelId; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Client.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Client.cs new file mode 100644 index 0000000..8788df2 --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Client.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 CarShowroomDatabaseStorage.Entities +{ + public class Client : IClient + { + public int Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public Client(IClient client) + { + Id = client.Id; + Name = client.Name; + Email = client.Email; + Password = client.Password; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.cs new file mode 100644 index 0000000..acc8f24 --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.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 CarShowroomDatabaseStorage.Entities +{ + public class Employee : IEmployee + { + public int Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public Employee(IEmployee employee) + { + Id = employee.Id; + Name = employee.Name; + Email = employee.Email; + Password = employee.Password; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Make.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Make.cs new file mode 100644 index 0000000..3d6ec5e --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Make.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 CarShowroomDatabaseStorage.Entities +{ + public class Make : IMake + { + public int Id { get; set; } + public string Name { get; set; } + public Make(IMake make) + { + Id = make.Id; + Name = make.Name; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Model.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Model.cs new file mode 100644 index 0000000..cbb7e2d --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Model.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 CarShowroomDatabaseStorage.Entities +{ + public class Model : IModel + { + public int Id { get; set; } + public string Name { get; set; } + public int Price { get; set; } + public int MakeId { get; set; } + public Model(IModel model) + { + Id = model.Id; + Name = model.Name; + Price = model.Price; + MakeId = model.MakeId; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs new file mode 100644 index 0000000..d11178e --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs @@ -0,0 +1,30 @@ +using CarShowroomContracts.AbstractModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarShowroomDatabaseStorage.Entities +{ + public class Sale : 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 CarIds { get; set; } + public List ServiceIds { get; set; } + public Sale(ISale sale) + { + Id = sale.Id; + SaleTime = sale.SaleTime; + Cost = sale.Cost; + ClientId = sale.ClientId; + EmployeeId = sale.EmployeeId; + CarIds = sale.CarIds; + ServiceIds = sale.ServiceIds; + } + } +} diff --git a/CarShowroom/CarShowroomDatabaseStorage/Entities/Service.cs b/CarShowroom/CarShowroomDatabaseStorage/Entities/Service.cs new file mode 100644 index 0000000..3f03e6b --- /dev/null +++ b/CarShowroom/CarShowroomDatabaseStorage/Entities/Service.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 CarShowroomDatabaseStorage.Entities +{ + internal class Service : IService + { + public int Id { get; set; } + public string Name { get; set; } + public int Cost { get; set; } + public Service(IService service) + { + Id = service.Id; + Name = service.Name; + Cost = service.Cost; + } + } +}