Создание сущностей-операций и интерфейсов к ним

This commit is contained in:
Павел Ладягин 2024-11-17 13:06:58 +04:00
parent 42f22622a6
commit 3c820d581e
8 changed files with 42 additions and 12 deletions

View File

@ -8,10 +8,10 @@ public class Car
public string Car_Mark { get; private set; } = string.Empty; public string Car_Mark { get; private set; } = string.Empty;
public string Car_Model { get; private set; } = string.Empty; public string Car_Model { get; private set; } = string.Empty;
public Car_Type Car_Type { get; private set; } public Car_Type Car_Type { get; private set; }
public Driver_License License { get; private set; }
public float Consumption_Rate { get; private set; } public float Consumption_Rate { get; private set; }
public int Fuel_ID { get; private set; }
public static Car CreateEntity (int car_ID, string car_mark, string car_model, Car_Type car_type, float consumption, int fuel_id) public static Car CreateEntity (int car_ID, string car_mark, string car_model, Car_Type car_type, Driver_License license, float consumption)
{ {
return new Car return new Car
{ {
@ -19,8 +19,8 @@ public class Car
Car_Mark = car_mark ?? string.Empty, Car_Mark = car_mark ?? string.Empty,
Car_Model = car_model ?? string.Empty, Car_Model = car_model ?? string.Empty,
Car_Type = car_type, Car_Type = car_type,
Consumption_Rate = consumption, License = license,
Fuel_ID = fuel_id Consumption_Rate = consumption
}; };
} }
} }

View File

@ -0,0 +1,22 @@
namespace FuelAndLubricants.Entities;
public class Refill
{
public int Refill_ID { get; private set; }
public DateTime Refill_Date { get; private set; }
public float Refill_Amount { get; private set; }
public int Fuel_ID { get; private set; }
public int Car_ID { get; private set; }
public static Refill CreateOperation(int refill_ID, DateTime refill_date, float refill_amount, int fuel_id, int car_id)
{
return new Refill
{
Refill_ID = refill_ID,
Refill_Date = refill_date,
Refill_Amount = refill_amount,
Fuel_ID = fuel_id,
Car_ID = car_id
};
}
}

View File

@ -13,7 +13,7 @@ public class Trip
public int Driver_ID { get; private set; } public int Driver_ID { get; private set; }
public int Route_ID { get; private set; } public int Route_ID { get; private set; }
public static Trip CreateEntity(int trip_id, DateTime start_date, DateTime end_date, Shift shift, float consumption, int car_id, int driver_id, int route_id) public static Trip CreateOperation(int trip_id, DateTime start_date, DateTime end_date, Shift shift, float consumption, int car_id, int driver_id, int route_id)
{ {
return new Trip return new Trip
{ {

View File

@ -10,7 +10,7 @@ public interface ICarRepository
void CreateCar(Car car); void CreateCar(Car car);
//void UpdateCar(Car car); void UpdateCar(Car car);
void DeleteCar(int id); void DeleteCar(int id);
} }

View File

@ -0,0 +1,12 @@
using FuelAndLubricants.Entities;
namespace FuelAndLubricants.Repositories;
public interface IRefillRepository
{
IEnumerable<Refill> ReadRefills();
Trip ReadRefillByID(int id);
void CreateRefill(Refill refill);
}

View File

@ -10,7 +10,7 @@ public interface IRouteRepository
void CreateRoute(Route route); void CreateRoute(Route route);
//void UpdateRoute(Route route); void UpdateRoute(Route route);
void DeleteRoute(int id); void DeleteRoute(int id);
} }

View File

@ -9,8 +9,4 @@ public interface ITripRepository
Trip ReadTripByID(int id); Trip ReadTripByID(int id);
void CreateTrip(Trip trip); void CreateTrip(Trip trip);
//void UpdateTrip(Trip trip);
void DeleteTrip(int id);
} }