diff --git a/RouteDirectory/RouteDirectory.sln b/RouteDirectory/RouteDirectory.sln
index d6c908d..c988efb 100644
--- a/RouteDirectory/RouteDirectory.sln
+++ b/RouteDirectory/RouteDirectory.sln
@@ -3,22 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteDirectoryDataModels", "RouteDirectoryBusinessLogics\RouteDirectoryDataModels.csproj", "{69BE4B26-1636-4661-B3AA-A29C531223D9}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteDirectoryContracts", "RouteDirectoryContracts\RouteDirectoryContracts.csproj", "{2A635E80-4C36-404E-BD93-932BB9DDCC80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteDirectoryDatabaseImplement", "RouteDirectoryDatabaseImplement\RouteDirectoryDatabaseImplement.csproj", "{0EEFDAB4-25D2-452E-A6D7-9E24F83D72FB}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteDirectoryBusinessLogics", "RouteDirectoryBusinessLogics\RouteDirectoryBusinessLogics.csproj", "{1912B63E-8ECF-4C69-AD87-14CBCC537F53}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteDirectoryDataModels", "RouteDirectoryDataModels\RouteDirectoryDataModels\RouteDirectoryDataModels.csproj", "{FC55798A-CB32-4A98-9228-7370FCD6821D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {69BE4B26-1636-4661-B3AA-A29C531223D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {69BE4B26-1636-4661-B3AA-A29C531223D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {69BE4B26-1636-4661-B3AA-A29C531223D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {69BE4B26-1636-4661-B3AA-A29C531223D9}.Release|Any CPU.Build.0 = Release|Any CPU
{2A635E80-4C36-404E-BD93-932BB9DDCC80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A635E80-4C36-404E-BD93-932BB9DDCC80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A635E80-4C36-404E-BD93-932BB9DDCC80}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -27,6 +25,14 @@ Global
{0EEFDAB4-25D2-452E-A6D7-9E24F83D72FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EEFDAB4-25D2-452E-A6D7-9E24F83D72FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EEFDAB4-25D2-452E-A6D7-9E24F83D72FB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1912B63E-8ECF-4C69-AD87-14CBCC537F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1912B63E-8ECF-4C69-AD87-14CBCC537F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1912B63E-8ECF-4C69-AD87-14CBCC537F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1912B63E-8ECF-4C69-AD87-14CBCC537F53}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FC55798A-CB32-4A98-9228-7370FCD6821D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FC55798A-CB32-4A98-9228-7370FCD6821D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FC55798A-CB32-4A98-9228-7370FCD6821D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FC55798A-CB32-4A98-9228-7370FCD6821D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/RouteLogic.cs b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/RouteLogic.cs
new file mode 100644
index 0000000..ee0325f
--- /dev/null
+++ b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/RouteLogic.cs
@@ -0,0 +1,221 @@
+using Microsoft.Extensions.Logging;
+using RouteDirectoryContracts.BindingModels;
+using RouteDirectoryContracts.BusinessLogicsContracts;
+using RouteDirectoryContracts.SearchModels;
+using RouteDirectoryContracts.StoragesContracts;
+using RouteDirectoryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RouteDirectoryBusinessLogics.BusinessLogics
+{
+ public class RouteLogic : IRouteLogic
+ {
+ ///
+ /// Логгер
+ ///
+ private readonly ILogger _logger;
+
+ ///
+ /// Хранилище
+ ///
+ private readonly IRouteStorage _routeStorage;
+
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ public RouteLogic(ILogger logger, IRouteStorage routeStorage)
+ {
+ _logger = logger;
+ _routeStorage = routeStorage;
+ }
+
+ ///
+ /// Получение списка
+ ///
+ ///
+ ///
+ public List? ReadList(RouteSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Route: {Name}.{Id}", model?.Id, model?.RouteNumber);
+
+ var list = model == null ? _routeStorage.GetFullList() : _routeStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение списка из заданного количества элементов
+ ///
+ ///
+ ///
+ public List? ReadList(int count)
+ {
+ _logger.LogInformation("ReadList. Count: {Count}", count);
+
+ var list = _routeStorage.GetList(count);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение отдельной записи
+ ///
+ ///
+ ///
+ ///
+ public RouteViewModel? ReadElement(RouteSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ _logger.LogInformation("ReadElement. Route: {Name}.{Id}", model?.Id, model?.RouteNumber);
+
+ var element = _routeStorage.GetElement(model!);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement. Element not found");
+ return null;
+ }
+
+ _logger.LogInformation("ReadElement. Find Route.Id: {Id}", element.Id);
+ return element;
+ }
+
+ ///
+ /// Создание записи
+ ///
+ ///
+ ///
+ public bool Create(RouteBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Create. Route.Id: {Id}", model.Id);
+
+ if (_routeStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Изменение записи
+ ///
+ ///
+ ///
+ public bool Update(RouteBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Update. Route.Id: {Id}", model.Id);
+
+ if (_routeStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ ///
+ public bool Delete(RouteBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Route.Id: {Id}", model.Id);
+
+ if (_routeStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ public bool Delete()
+ {
+ _logger.LogInformation("Delete. Route");
+
+ if (_routeStorage.Delete() == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление всех записей
+ ///
+ ///
+ public int Clear()
+ {
+ int count = _routeStorage.Clear();
+ _logger.LogInformation("Clear. Delete {Count} Routes", count);
+ return count;
+ }
+
+ ///
+ /// Проверка модели
+ ///
+ ///
+ ///
+ private void CheckModel(RouteBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.RouteNumber))
+ {
+ throw new ArgumentNullException("Не указано название маршрута", nameof(model.RouteNumber));
+ }
+ if (model.TransportId < 0)
+ {
+ throw new ArgumentNullException("Некорректный идентификатор транспортного средства", nameof(model.TransportId));
+ }
+
+ _logger.LogInformation("CheckModel. Route.Id: {Id}", model.Id);
+
+ var element = _routeStorage.GetElement(new RouteSearchModel
+ {
+ RouteNumber = model.RouteNumber
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Маршрут с таким названием уже существует");
+ }
+ }
+ }
+}
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/ScheduleLogic.cs b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/ScheduleLogic.cs
new file mode 100644
index 0000000..c4a26e5
--- /dev/null
+++ b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/ScheduleLogic.cs
@@ -0,0 +1,211 @@
+using Microsoft.Extensions.Logging;
+using RouteDirectoryContracts.BindingModels;
+using RouteDirectoryContracts.BusinessLogicsContracts;
+using RouteDirectoryContracts.SearchModels;
+using RouteDirectoryContracts.StoragesContracts;
+using RouteDirectoryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RouteDirectoryBusinessLogics.BusinessLogics
+{
+ ///
+ /// Бизнес-логика для сущности "Расписание"
+ ///
+ public class ScheduleLogic : IScheduleLogic
+ {
+ ///
+ /// Логгер
+ ///
+ private readonly ILogger _logger;
+
+ ///
+ /// Хранилище
+ ///
+ private readonly IScheduleStorage _scheduleStorage;
+
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ public ScheduleLogic(ILogger logger, IScheduleStorage scheduleStorage)
+ {
+ _logger = logger;
+ _scheduleStorage = scheduleStorage;
+ }
+
+ ///
+ /// Получение списка
+ ///
+ ///
+ ///
+ public List? ReadList(ScheduleSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Schedule.{Id}", model?.Id);
+
+ var list = model == null ? _scheduleStorage.GetFullList() : _scheduleStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение списка из заданного количества элементов
+ ///
+ ///
+ ///
+ public List? ReadList(int count)
+ {
+ _logger.LogInformation("ReadList. Count: {Count}", count);
+
+ var list = _scheduleStorage.GetList(count);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение отдельной записи
+ ///
+ ///
+ ///
+ ///
+ public ScheduleViewModel? ReadElement(ScheduleSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ _logger.LogInformation("ReadElement. Schedule.{Id}", model?.Id);
+
+ var element = _scheduleStorage.GetElement(model!);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement. Element not found");
+ return null;
+ }
+
+ _logger.LogInformation("ReadElement. Find Schedule.Id: {Id}", element.Id);
+ return element;
+ }
+
+ ///
+ /// Создание записи
+ ///
+ ///
+ ///
+ public bool Create(ScheduleBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Create. Schedule.Id: {Id}", model.Id);
+
+ if (_scheduleStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Изменение записи
+ ///
+ ///
+ ///
+ public bool Update(ScheduleBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Update. Schedule.Id: {Id}", model.Id);
+
+ if (_scheduleStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ ///
+ public bool Delete(ScheduleBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Schedule.Id: {Id}", model.Id);
+
+ if (_scheduleStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ public bool Delete()
+ {
+ _logger.LogInformation("Delete. Schedule");
+
+ if (_scheduleStorage.Delete() == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление всех записей
+ ///
+ ///
+ public int Clear()
+ {
+ int count = _scheduleStorage.Clear();
+ _logger.LogInformation("Clear. Delete {Count} Schedules", count);
+ return count;
+ }
+
+ ///
+ /// Проверка модели
+ ///
+ ///
+ ///
+ private void CheckModel(ScheduleBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (model.RouteId < 0)
+ {
+ throw new ArgumentNullException("Некорректный идентификатор маршрута", nameof(model.RouteId));
+ }
+
+ _logger.LogInformation("CheckModel. Schedule.Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/StopLogic.cs b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/StopLogic.cs
new file mode 100644
index 0000000..0749006
--- /dev/null
+++ b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/StopLogic.cs
@@ -0,0 +1,219 @@
+using Microsoft.Extensions.Logging;
+using RouteDirectoryContracts.BindingModels;
+using RouteDirectoryContracts.BusinessLogicsContracts;
+using RouteDirectoryContracts.SearchModels;
+using RouteDirectoryContracts.StoragesContracts;
+using RouteDirectoryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RouteDirectoryBusinessLogics.BusinessLogics
+{
+ ///
+ /// Бизнес-логика для сущности "Остановка"
+ ///
+ public class StopLogic : IStopLogic
+ {
+ ///
+ /// Логгер
+ ///
+ private readonly ILogger _logger;
+
+ ///
+ /// Хранилище
+ ///
+ private readonly IStopStorage _stopStorage;
+
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ public StopLogic(ILogger logger, IStopStorage stopStorage)
+ {
+ _logger = logger;
+ _stopStorage = stopStorage;
+ }
+
+ ///
+ /// Получение списка
+ ///
+ ///
+ ///
+ public List? ReadList(StopSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Stop: {Name}.{Id}", model?.Id, model?.Name);
+
+ var list = model == null ? _stopStorage.GetFullList() : _stopStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение списка из заданного количества элементов
+ ///
+ ///
+ ///
+ public List? ReadList(int count)
+ {
+ _logger.LogInformation("ReadList. Count: {Count}", count);
+
+ var list = _stopStorage.GetList(count);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение отдельной записи
+ ///
+ ///
+ ///
+ ///
+ public StopViewModel? ReadElement(StopSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ _logger.LogInformation("ReadElement. Stop: {Name}.{Id}", model?.Id, model?.Name);
+
+ var element = _stopStorage.GetElement(model!);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement. Element not found");
+ return null;
+ }
+
+ _logger.LogInformation("ReadElement. Find Stop.Id: {Id}", element.Id);
+ return element;
+ }
+
+ ///
+ /// Создание записи
+ ///
+ ///
+ ///
+ public bool Create(StopBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Create. Stop.Id: {Id}", model.Id);
+
+ if (_stopStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Изменение записи
+ ///
+ ///
+ ///
+ public bool Update(StopBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Update. Stop.Id: {Id}", model.Id);
+
+ if (_stopStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ ///
+ public bool Delete(StopBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Stop.Id: {Id}", model.Id);
+
+ if (_stopStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ public bool Delete()
+ {
+ _logger.LogInformation("Delete. Stop");
+
+ if (_stopStorage.Delete() == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление всех записей
+ ///
+ ///
+ public int Clear()
+ {
+ int count = _stopStorage.Clear();
+ _logger.LogInformation("Clear. Delete {Count} Stops", count);
+ return count;
+ }
+
+ ///
+ /// Проверка модели
+ ///
+ ///
+ ///
+ private void CheckModel(StopBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Name))
+ {
+ throw new ArgumentNullException("Не указано название остановки", nameof(model.Name));
+ }
+ _logger.LogInformation("CheckModel. Stop.Id: {Id}", model.Id);
+
+ var element = _stopStorage.GetElement(new StopSearchModel
+ {
+ Name = model.Name
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Остановка с таким названием уже существует");
+ }
+ }
+ }
+}
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/TransportTypeLogic.cs b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/TransportTypeLogic.cs
new file mode 100644
index 0000000..3b0698a
--- /dev/null
+++ b/RouteDirectory/RouteDirectoryBusinessLogics/BusinessLogics/TransportTypeLogic.cs
@@ -0,0 +1,206 @@
+using Microsoft.Extensions.Logging;
+using RouteDirectoryContracts.BindingModels;
+using RouteDirectoryContracts.BusinessLogicsContracts;
+using RouteDirectoryContracts.SearchModels;
+using RouteDirectoryContracts.StoragesContracts;
+using RouteDirectoryContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RouteDirectoryBusinessLogics.BusinessLogics
+{
+ ///
+ /// Бизнес-логика для сущности "Транспорт"
+ ///
+ public class TransportTypeLogic : ITransportTypeLogic
+ {
+ ///
+ /// Логгер
+ ///
+ private readonly ILogger _logger;
+
+ ///
+ /// Хранилище
+ ///
+ private readonly ITransportTypeStorage _transportStorage;
+
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ public TransportTypeLogic(ILogger logger, ITransportTypeStorage transportStorage)
+ {
+ _logger = logger;
+ _transportStorage = transportStorage;
+ }
+
+ ///
+ /// Получение списка
+ ///
+ ///
+ ///
+ public List? ReadList(TransportTypeSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Transport: {Id}.{License}", model?.Id);
+
+ var list = model == null ? _transportStorage.GetFullList() : _transportStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение списка из заданного количества элементов
+ ///
+ ///
+ ///
+ public List? ReadList(int count)
+ {
+ _logger.LogInformation("ReadList. Count: {Count}", count);
+
+ var list = _transportStorage.GetList(count);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList. Returned null list");
+ return null;
+ }
+
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ ///
+ /// Получение отдельной записи
+ ///
+ ///
+ ///
+ ///
+ public TransportTypeViewModel? ReadElement(TransportTypeSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ _logger.LogInformation("ReadElement. Transport: {Id}", model?.Id);
+
+ var element = _transportStorage.GetElement(model!);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement. Element not found");
+ return null;
+ }
+
+ _logger.LogInformation("ReadElement. Find Transport.Id: {Id}", element.Id);
+ return element;
+ }
+
+ ///
+ /// Создание записи
+ ///
+ ///
+ ///
+ public bool Create(TransportTypeBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Create. Transport.Id: {Id}", model.Id);
+
+ if (_transportStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Изменение записи
+ ///
+ ///
+ ///
+ public bool Update(TransportTypeBindingModel model)
+ {
+ CheckModel(model);
+ _logger.LogInformation("Update. Transport.Id: {Id}", model.Id);
+
+ if (_transportStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ ///
+ public bool Delete(TransportTypeBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Transport.Id: {Id}", model.Id);
+
+ if (_transportStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление записи
+ ///
+ ///
+ public bool Delete()
+ {
+ _logger.LogInformation("Delete. Transport");
+
+ if (_transportStorage.Delete() == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// Удаление всех записей
+ ///
+ ///
+ public int Clear()
+ {
+ int count = _transportStorage.Clear();
+ _logger.LogInformation("Clear. Delete {Count} Transports", count);
+ return count;
+ }
+
+ ///
+ /// Проверка модели
+ ///
+ ///
+ ///
+ private void CheckModel(TransportTypeBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("CheckModel. Transport.Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/RouteDirectoryBusinessLogics.csproj b/RouteDirectory/RouteDirectoryBusinessLogics/RouteDirectoryBusinessLogics.csproj
new file mode 100644
index 0000000..7f48467
--- /dev/null
+++ b/RouteDirectory/RouteDirectoryBusinessLogics/RouteDirectoryBusinessLogics.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/RouteDirectory/RouteDirectoryContracts/RouteDirectoryContracts.csproj b/RouteDirectory/RouteDirectoryContracts/RouteDirectoryContracts.csproj
index 50a43cf..3f3f264 100644
--- a/RouteDirectory/RouteDirectoryContracts/RouteDirectoryContracts.csproj
+++ b/RouteDirectory/RouteDirectoryContracts/RouteDirectoryContracts.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/Enums/TransportType.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Enums/TransportType.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/Enums/TransportType.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Enums/TransportType.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/IId.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/IId.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/IId.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/IId.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/Models/IRouteModel.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IRouteModel.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/Models/IRouteModel.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IRouteModel.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/Models/IScheduleModel.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/Models/IScheduleModel.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IScheduleModel.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/Models/IStopModel.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IStopModel.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/Models/IStopModel.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/IStopModel.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/Models/ITransportTypeModel.cs b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/ITransportTypeModel.cs
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/Models/ITransportTypeModel.cs
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/Models/ITransportTypeModel.cs
diff --git a/RouteDirectory/RouteDirectoryBusinessLogics/RouteDirectoryDataModels.csproj b/RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/RouteDirectoryDataModels.csproj
similarity index 100%
rename from RouteDirectory/RouteDirectoryBusinessLogics/RouteDirectoryDataModels.csproj
rename to RouteDirectory/RouteDirectoryDataModels/RouteDirectoryDataModels/RouteDirectoryDataModels.csproj
diff --git a/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabaseImplement.csproj b/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabaseImplement.csproj
index 58b4165..f0c1b83 100644
--- a/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabaseImplement.csproj
+++ b/RouteDirectory/RouteDirectoryDatabaseImplement/RouteDirectoryDatabaseImplement.csproj
@@ -16,8 +16,8 @@
-
+