start Entities

This commit is contained in:
Zakharov_Rostislav 2024-05-03 11:28:27 +04:00
parent 3dc7f5186d
commit 34a61279d1
11 changed files with 176 additions and 7 deletions

View File

@ -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<int> CarIds { get; }
List<int> ServiseIds { get; }
List<int> ServiceIds { get; }
}
}

View File

@ -15,7 +15,7 @@ namespace CarShowroomDataModels.Dtos
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 List<int> 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;
}
}
}

View File

@ -31,14 +31,14 @@ namespace CarShowroomDataModels.Dtos
}
}
public List<CarView> Cars { get; set; } = new();
public List<int> ServiseIds
public List<int> ServiceIds
{
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)
{
Id = model.Id;

View File

@ -8,6 +8,7 @@
<ItemGroup>
<ProjectReference Include="..\CarShowroomContracts\CarShowroomContracts.csproj" />
<ProjectReference Include="..\CarShowroomDataModels\CarShowroomDataModels.csproj" />
</ItemGroup>
</Project>

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

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 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;
}
}
}

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 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;
}
}
}