start Entities
This commit is contained in:
parent
3dc7f5186d
commit
34a61279d1
@ -7,13 +7,13 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace CarShowroomContracts.AbstractModels
|
namespace CarShowroomContracts.AbstractModels
|
||||||
{
|
{
|
||||||
internal interface ISale : IId
|
public interface ISale : IId
|
||||||
{
|
{
|
||||||
DateTime SaleTime { get; }
|
DateTime SaleTime { get; }
|
||||||
int Cost { get; }
|
int Cost { get; }
|
||||||
int ClientId { get; }
|
int ClientId { get; }
|
||||||
int EmployeeId { get; }
|
int EmployeeId { get; }
|
||||||
List<int> CarIds { get; }
|
List<int> CarIds { get; }
|
||||||
List<int> ServiseIds { get; }
|
List<int> ServiceIds { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace CarShowroomDataModels.Dtos
|
|||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public int EmployeeId { get; set; }
|
public int EmployeeId { get; set; }
|
||||||
public List<int> CarIds { get; set; } = new();
|
public List<int> CarIds { get; set; } = new();
|
||||||
public List<int> ServiseIds { get; set; } = new();
|
public List<int> ServiceIds { get; set; } = new();
|
||||||
public SaleDto(ISale model)
|
public SaleDto(ISale model)
|
||||||
{
|
{
|
||||||
Id = model.Id;
|
Id = model.Id;
|
||||||
@ -24,7 +24,7 @@ namespace CarShowroomDataModels.Dtos
|
|||||||
ClientId = model.ClientId;
|
ClientId = model.ClientId;
|
||||||
EmployeeId = model.EmployeeId;
|
EmployeeId = model.EmployeeId;
|
||||||
CarIds = model.CarIds;
|
CarIds = model.CarIds;
|
||||||
ServiseIds = model.ServiseIds;
|
ServiceIds = model.ServiceIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,14 @@ namespace CarShowroomDataModels.Dtos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<CarView> Cars { get; set; } = new();
|
public List<CarView> Cars { get; set; } = new();
|
||||||
public List<int> ServiseIds
|
public List<int> ServiceIds
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Servises.Select(s => s.Id).ToList();
|
return Services.Select(s => s.Id).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<ServiceView> Servises { get; set; } = new();
|
public List<ServiceView> Services { get; set; } = new();
|
||||||
public SaleView(ISale model)
|
public SaleView(ISale model)
|
||||||
{
|
{
|
||||||
Id = model.Id;
|
Id = model.Id;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CarShowroomContracts\CarShowroomContracts.csproj" />
|
<ProjectReference Include="..\CarShowroomContracts\CarShowroomContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\CarShowroomDataModels\CarShowroomDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Car.cs
Normal file
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Car.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Client.cs
Normal file
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Client.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.cs
Normal file
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Employee.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
CarShowroom/CarShowroomDatabaseStorage/Entities/Make.cs
Normal file
20
CarShowroom/CarShowroomDatabaseStorage/Entities/Make.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Model.cs
Normal file
24
CarShowroom/CarShowroomDatabaseStorage/Entities/Model.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs
Normal file
30
CarShowroom/CarShowroomDatabaseStorage/Entities/Sale.cs
Normal 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 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<int> CarIds { get; set; }
|
||||||
|
public List<int> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
CarShowroom/CarShowroomDatabaseStorage/Entities/Service.cs
Normal file
22
CarShowroom/CarShowroomDatabaseStorage/Entities/Service.cs
Normal 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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user