diff --git a/JurassicZoo/JurassicZoo.sln b/JurassicZoo/JurassicZoo.sln
new file mode 100644
index 0000000..246e413
--- /dev/null
+++ b/JurassicZoo/JurassicZoo.sln
@@ -0,0 +1,59 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.3.32922.545
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JurassicZoo", "JurassicZoo\JurassicZoo.csproj", "{6BEB62C6-55C0-4A87-A29C-FA47E9AF3F9A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooBusinessLogic", "ZooBusinessLogic\ZooBusinessLogic.csproj", "{039AC9DE-F7CE-419F-8285-F464FBD2E6D7}"
+ ProjectSection(ProjectDependencies) = postProject
+ {71985B4A-E333-4553-A5F4-697AD9A52214} = {71985B4A-E333-4553-A5F4-697AD9A52214}
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12} = {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooContracts", "ZooContracts\ZooContracts.csproj", "{7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}"
+ ProjectSection(ProjectDependencies) = postProject
+ {51227D08-FB94-4864-93D0-2CA9E5F9E64B} = {51227D08-FB94-4864-93D0-2CA9E5F9E64B}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooDatabaseImplements", "ZooDatabaseImplements\ZooDatabaseImplements.csproj", "{71985B4A-E333-4553-A5F4-697AD9A52214}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12} = {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooDataModels", "ZooDataModels\ZooDataModels.csproj", "{51227D08-FB94-4864-93D0-2CA9E5F9E64B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6BEB62C6-55C0-4A87-A29C-FA47E9AF3F9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6BEB62C6-55C0-4A87-A29C-FA47E9AF3F9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6BEB62C6-55C0-4A87-A29C-FA47E9AF3F9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6BEB62C6-55C0-4A87-A29C-FA47E9AF3F9A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {039AC9DE-F7CE-419F-8285-F464FBD2E6D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {039AC9DE-F7CE-419F-8285-F464FBD2E6D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {039AC9DE-F7CE-419F-8285-F464FBD2E6D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {039AC9DE-F7CE-419F-8285-F464FBD2E6D7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7DA51D9D-D23D-4A43-BF92-E7ADE28A8F12}.Release|Any CPU.Build.0 = Release|Any CPU
+ {71985B4A-E333-4553-A5F4-697AD9A52214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {71985B4A-E333-4553-A5F4-697AD9A52214}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {71985B4A-E333-4553-A5F4-697AD9A52214}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {71985B4A-E333-4553-A5F4-697AD9A52214}.Release|Any CPU.Build.0 = Release|Any CPU
+ {51227D08-FB94-4864-93D0-2CA9E5F9E64B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {51227D08-FB94-4864-93D0-2CA9E5F9E64B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {51227D08-FB94-4864-93D0-2CA9E5F9E64B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {51227D08-FB94-4864-93D0-2CA9E5F9E64B}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {00BB5CC0-10EA-448E-9161-DF4DB5C6D1FC}
+ EndGlobalSection
+EndGlobal
diff --git a/JurassicZoo/JurassicZoo/JurassicZoo.csproj b/JurassicZoo/JurassicZoo/JurassicZoo.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/JurassicZoo/JurassicZoo/JurassicZoo.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/JurassicZoo/ReportLogic.cs b/JurassicZoo/ReportLogic.cs
new file mode 100644
index 0000000..d555ecb
--- /dev/null
+++ b/JurassicZoo/ReportLogic.cs
@@ -0,0 +1,8 @@
+using System;
+
+public class Class1
+{
+ public Class1()
+ {
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/ClientLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ClientLogic.cs
new file mode 100644
index 0000000..734c75b
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ClientLogic.cs
@@ -0,0 +1,151 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class ClientLogic : IClientLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IClientStorage _clientStorage;
+ public ClientLogic(ILogger logger, IClientStorage clientStorage)
+ {
+ _logger = logger;
+ _clientStorage = clientStorage;
+ }
+ public bool Create(ClientBindingModel model)
+ {
+ CheckModel(model);
+ if (_clientStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(ClientBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id: {Id}", model.Id);
+ if (_clientStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public ClientViewModel? ReadElement(ClientSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _clientStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(ClientSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(ClientBindingModel model)
+ {
+ CheckModel(model);
+ if (_clientStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(ClientBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ClientEmail))
+ {
+ _logger.LogWarning("Email is empty");
+ throw new ArgumentException("Не введён email");
+ }
+ if (model.ClientEmail.Length > 35)
+ {
+ _logger.LogWarning("Email {Email} length > 35", model.ClientEmail);
+ throw new ArgumentException("Длина email не должна превышать 35 символов");
+ }
+ var existingClient = _clientStorage.GetElement(new()
+ {
+ ClientEmail = model.ClientEmail
+ });
+ if (existingClient != null)
+ {
+ _logger.LogWarning("Client with email {Email} already exists", model.ClientEmail);
+ throw new ArgumentException("Клиент с таким email уже существует");
+ }
+ if (string.IsNullOrEmpty(model.ClientPassword))
+ {
+ _logger.LogWarning("Password is empty");
+ throw new ArgumentException("Не введён пароль");
+ }
+ if (model.ClientPassword.Length < 7 || model.ClientPassword.Length > 30)
+ {
+ _logger.LogWarning("Password {Password} length > 30 or < 7", model.ClientPassword);
+ throw new ArgumentException("Длина пароля должна быть в промежутке между 7 и 30 символами");
+ }
+ if (string.IsNullOrEmpty(model.ClientName))
+ {
+ _logger.LogWarning("Name is empty");
+ throw new ArgumentException("Не введёно имя");
+ }
+ if (model.ClientName.Length > 30)
+ {
+ _logger.LogWarning("Name {Name} length > 30", model.ClientName);
+ throw new ArgumentException("Длина имени не должна превышать 30 символов");
+ }
+ if (string.IsNullOrEmpty(model.ClientPhone))
+ {
+ _logger.LogWarning("Phone is empty");
+ throw new ArgumentException("Не введён телефон");
+ }
+ if (model.ClientPhone.Length == 11)
+ {
+ _logger.LogWarning("Phone {Phone} length == 11", model.ClientPhone);
+ throw new ArgumentException("Длина телефона должна быть 11 символов");
+ }
+ _logger.LogInformation("Client. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/CostLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/CostLogic.cs
new file mode 100644
index 0000000..a0f3c66
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/CostLogic.cs
@@ -0,0 +1,102 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class CostLogic : ICostLogic
+ {
+ private readonly ILogger _logger;
+ private readonly ICostStorage _CostStorage;
+ public CostLogic(ILogger logger, ICostStorage CostStorage)
+ {
+ _logger = logger;
+ _CostStorage = CostStorage;
+ }
+
+ public bool Create(CostBindingModel model)
+ {
+ CheckModel(model);
+ if (_CostStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(CostBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id: {Id}", model.Id);
+ if (_CostStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public CostViewModel? ReadElement(CostSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _CostStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(CostSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _CostStorage.GetFullList() : _CostStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(CostBindingModel model)
+ {
+ CheckModel(model);
+ if (_CostStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(CostBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Cost. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/EmployeeLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/EmployeeLogic.cs
new file mode 100644
index 0000000..5ce7bef
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/EmployeeLogic.cs
@@ -0,0 +1,101 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class EmployeeLogic : IEmployeeLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IEmployeeStorage _employeeStorage;
+ public EmployeeLogic(ILogger logger, IEmployeeStorage employeeStorage)
+ {
+ _logger = logger;
+ _employeeStorage = employeeStorage;
+ }
+ public bool Create(EmployeeBindingModel model)
+ {
+ CheckModel(model);
+ if (_employeeStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(EmployeeBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_employeeStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public EmployeeViewModel? ReadElement(EmployeeSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _employeeStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(EmployeeSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _employeeStorage.GetFullList() : _employeeStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(EmployeeBindingModel model)
+ {
+ CheckModel(model);
+ if (_employeeStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(EmployeeBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Employee. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/PaymentLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/PaymentLogic.cs
new file mode 100644
index 0000000..f91408f
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/PaymentLogic.cs
@@ -0,0 +1,63 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class PaymentLogic : IPaymentLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IPaymentStorage _paymentStorage;
+ public PaymentLogic(ILogger logger, IPaymentStorage paymentStorage)
+ {
+ _logger = logger;
+ _paymentStorage = paymentStorage;
+ }
+ public bool Create(PaymentBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool Delete(PaymentBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public PaymentViewModel? ReadElement(PaymentSearchModel model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public List? ReadList(PaymentSearchModel? model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool Update(PaymentBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+ private void CheckModel(ReserveBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Reserve. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportLogic.cs
new file mode 100644
index 0000000..5e32dc9
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportLogic.cs
@@ -0,0 +1,46 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.BusinessLogicsContracts;
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class ReportLogic : IReportLogic
+ {
+ private readonly IRouteStorage _RouteStorage;
+ private readonly ILogger _logger;
+
+ public ReportLogic(ILogger _logger, IRouteStorage RouteStorage)
+ {
+ //_logger = logger;
+ _RouteStorage = RouteStorage;
+ }
+ ///
+ /// Получение списка кружков с указанием списка затрат по ним за определенное время
+ ///
+ ///
+ public List GetReserveRoutes(ReportBindingModel model)
+ {
+ return _RouteStorage.GetReserveRoutes(new() { SelectedRoutesIds = model.SelectedRoutes });
+ }
+
+ public void SaveComponentsToWordFile(ReportBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void SaveManufactureComponentToExcelFile(ReportBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void SaveOrdersToPdfFile(ReportBindingModel model)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportReserveLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportReserveLogic.cs
new file mode 100644
index 0000000..c751dee
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReportReserveLogic.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ internal class ReportReserveLogic
+ {
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReserveLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReserveLogic.cs
new file mode 100644
index 0000000..7e610f9
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/ReserveLogic.cs
@@ -0,0 +1,101 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class ReserveLogic : IReserveLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IReserveStorage _ReserveStorage;
+ public ReserveLogic(ILogger logger, IReserveStorage ReserveStorage)
+ {
+ _logger = logger;
+ _ReserveStorage = ReserveStorage;
+ }
+ public bool Create(ReserveBindingModel model)
+ {
+ CheckModel(model);
+ if (_ReserveStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(ReserveBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_ReserveStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public ReserveViewModel? ReadElement(ReserveSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _ReserveStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(ReserveSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _ReserveStorage.GetFullList() : _ReserveStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(ReserveBindingModel model)
+ {
+ CheckModel(model);
+ if (_ReserveStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(ReserveBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Reserve. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteCostLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteCostLogic.cs
new file mode 100644
index 0000000..caa313a
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteCostLogic.cs
@@ -0,0 +1,103 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class RouteCostLogic : IRouteCostLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IRouteCostStorage _RouteCostStorage;
+ public RouteCostLogic(ILogger logger, IRouteCostStorage RouteCostStorage)
+ {
+ _logger = logger;
+ _RouteCostStorage = RouteCostStorage;
+ }
+
+ public bool Create(RouteCostBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteCostStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(RouteCostBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id: {Id}", model.Id);
+ if (_RouteCostStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public RouteCostViewModel? ReadElement(RouteCostSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _RouteCostStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(RouteCostSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _RouteCostStorage.GetFullList() : _RouteCostStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(RouteCostBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteCostStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(RouteCostBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("RouteCost. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteLogic.cs
new file mode 100644
index 0000000..02e9b61
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteLogic.cs
@@ -0,0 +1,103 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class RouteLogic : IRouteLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IRouteStorage _RouteStorage;
+ public RouteLogic(ILogger logger, IRouteStorage RouteStorage)
+ {
+ _logger = logger;
+ _RouteStorage = RouteStorage;
+ }
+
+ public bool Create(RouteBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(RouteBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id: {Id}", model.Id);
+ if (_RouteStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public RouteViewModel? ReadElement(RouteSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _RouteStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(RouteSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _RouteStorage.GetFullList() : _RouteStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(RouteBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(RouteBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Route. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteReserveLogic.cs b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteReserveLogic.cs
new file mode 100644
index 0000000..2c8a28e
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/BusinessLogics/RouteReserveLogic.cs
@@ -0,0 +1,102 @@
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BusinessLogicsContracts;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements.Implements;
+
+namespace ZooBusinessLogic.BusinessLogics
+{
+ public class RouteReserveLogic : IRouteReserveLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IRouteReserveStorage _RouteReserveStorage;
+ public RouteReserveLogic(ILogger logger, IRouteReserveStorage RouteReserveStorage)
+ {
+ _logger = logger;
+ _RouteReserveStorage = RouteReserveStorage;
+ }
+
+ public bool Create(RouteReserveBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteReserveStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(RouteReserveBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id: {Id}", model.Id);
+ if (_RouteReserveStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public RouteReserveViewModel? ReadElement(RouteReserveSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id: {Id}", model.Id);
+ var element = _RouteReserveStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement found. Id: {Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(RouteReserveSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id: {Id}", model?.Id);
+ var list = model == null ? _RouteReserveStorage.GetFullList() : _RouteReserveStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count: {Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(RouteReserveBindingModel model)
+ {
+ CheckModel(model);
+ if (_RouteReserveStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(RouteReserveBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("RouteReserve. Id: {Id}", model.Id);
+ }
+ }
+}
diff --git a/JurassicZoo/ZooBusinessLogic/ZooBusinessLogic.csproj b/JurassicZoo/ZooBusinessLogic/ZooBusinessLogic.csproj
new file mode 100644
index 0000000..16f04b5
--- /dev/null
+++ b/JurassicZoo/ZooBusinessLogic/ZooBusinessLogic.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/JurassicZoo/ZooContracts/BindingModels/ClientBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/ClientBindingModel.cs
new file mode 100644
index 0000000..3ff80eb
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/ClientBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class ClientBindingModel : IClientModel
+ {
+ public int Id { get; set; }
+ public string ClientName { get; set; } = string.Empty;
+ public string ClientEmail { get; set; } = string.Empty;
+ public string ClientPhone { get; set; } = string.Empty;
+ public string ClientPassword { get; set; } = string.Empty;
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/CostBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/CostBindingModel.cs
new file mode 100644
index 0000000..93095b8
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/CostBindingModel.cs
@@ -0,0 +1,16 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class CostBindingModel : ICostModel
+ {
+ public int Id { get; set; }
+ public double Sum { get; set; }
+ public string CostName { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/EmployeeBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/EmployeeBindingModel.cs
new file mode 100644
index 0000000..23c2cd8
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/EmployeeBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class EmployeeBindingModel : IEmployeeModel
+ {
+ public int Id { get; set; }
+ public string EmployeeName { get; set; } = string.Empty;
+ public string EmployeePassword { get; set; } = string.Empty;
+ public string EmployeeEmail { get; set; } = string.Empty;
+ public string EmployeePhone { get; set; } = string.Empty;
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/PaymentBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/PaymentBindingModel.cs
new file mode 100644
index 0000000..0d0171b
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/PaymentBindingModel.cs
@@ -0,0 +1,17 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class PaymentBindingModel: IPaymentModel
+ {
+ public int Id { get; set; }
+ public double PaySum { get; set; }
+ public DateTime? DateOfPayment { get; set; } = DateTime.Now;
+ public int RouteReserveId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/ReportBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/ReportBindingModel.cs
new file mode 100644
index 0000000..0d8643b
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/ReportBindingModel.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class ReportBindingModel
+ {
+ public string FileName { get; set; } = string.Empty;
+ ///
+ /// Выбранные маршруты для отчета
+ ///
+ public List? SelectedCircles { get; set; }
+ ///
+ /// Начало периода для отчета по затратам
+ ///
+ public DateTime? DateFrom { get; set; }
+ ///
+ /// Конец периода для отчета по затратам
+ ///
+ public DateTime? DateTo { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/ReserveBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/ReserveBindingModel.cs
new file mode 100644
index 0000000..d37f295
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/ReserveBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class ReserveBindingModel : IReserveModel
+ {
+ public int Id { get; set; }
+ public string ReserveName { get; set; }
+ public double ReservePrice { get; set; }
+ public int EmployeeId { get; set; }
+ public string EmployeeName { get; set; } = string.Empty;
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/RouteBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/RouteBindingModel.cs
new file mode 100644
index 0000000..4c9311d
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/RouteBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class RouteBindingModel : IRouteModel
+ {
+ public int Id { get; set; }
+ public DateTime DateStart { get; set; } = DateTime.Now;
+ public int ClientId { get; set; }
+ public int ReserveId { get; set; }
+ public double Remains { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/RouteCostBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/RouteCostBindingModel.cs
new file mode 100644
index 0000000..2965dd8
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/RouteCostBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class RouteCostBindingModel : IRouteCostModel
+ {
+ public int RouteId { get; set; }
+
+ public int CostId { get; set; }
+
+ public int Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BindingModels/RouteReserveBindingModel.cs b/JurassicZoo/ZooContracts/BindingModels/RouteReserveBindingModel.cs
new file mode 100644
index 0000000..d135aec
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BindingModels/RouteReserveBindingModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BindingModels
+{
+ public class RouteReserveBindingModel : IRouteReserveModel
+ {
+ public int RouteId { get; set; }
+
+ public int ReserveId { get; set; }
+
+ public int Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IClientLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IClientLogic.cs
new file mode 100644
index 0000000..76b475e
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IClientLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IClientLogic
+ {
+ List? ReadList(ClientSearchModel? model);
+ ClientViewModel? ReadElement(ClientSearchModel model);
+ bool Create(ClientBindingModel model);
+ bool Update(ClientBindingModel model);
+ bool Delete(ClientBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/ICostLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/ICostLogic.cs
new file mode 100644
index 0000000..3414aa5
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/ICostLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface ICostLogic
+ {
+ List? ReadList(CostSearchModel? model);
+ CostViewModel? ReadElement(CostSearchModel model);
+ bool Create(CostBindingModel model);
+ bool Update(CostBindingModel model);
+ bool Delete(CostBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IEmployeeLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IEmployeeLogic.cs
new file mode 100644
index 0000000..22bf23c
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IEmployeeLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IEmployeeLogic
+ {
+ List? ReadList(EmployeeSearchModel? model);
+ EmployeeViewModel? ReadElement(EmployeeSearchModel model);
+ bool Create(EmployeeBindingModel model);
+ bool Update(EmployeeBindingModel model);
+ bool Delete(EmployeeBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IPaymentLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IPaymentLogic.cs
new file mode 100644
index 0000000..410511d
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IPaymentLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IPaymentLogic
+ {
+ List? ReadList(PaymentSearchModel? model);
+ PaymentViewModel? ReadElement(PaymentSearchModel model);
+ bool Create(PaymentBindingModel model);
+ bool Update(PaymentBindingModel model);
+ bool Delete(PaymentBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportLogic.cs
new file mode 100644
index 0000000..5b969f2
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportLogic.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IReportLogic
+ {
+ ///
+ /// Получение списка Маршрутов по заповедникам
+ ///
+ ///
+ List GetReserveRoutes(ReportBindingModel model);
+ ///
+ /// Сохранение компонент в файл-Word
+ ///
+ ///
+ void SaveComponentsToWordFile(ReportBindingModel model);
+ ///
+ /// Сохранение компонент с указаеним продуктов в файл-Excel
+ ///
+ ///
+ void SaveComponentToExcelFile(ReportBindingModel model);
+ ///
+ /// Сохранение заказов в файл-Pdf
+ ///
+ ///
+ void SaveOrdersToPdfFile(ReportBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportReservesLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportReservesLogic.cs
new file mode 100644
index 0000000..fc476c8
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReportReservesLogic.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IReportReservesLogic
+ {
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReserveLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReserveLogic.cs
new file mode 100644
index 0000000..466e1de
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IReserveLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IReserveLogic
+ {
+ List? ReadList(ReserveSearchModel? model);
+ ReserveViewModel? ReadElement(ReserveSearchModel model);
+ bool Create(ReserveBindingModel model);
+ bool Update(ReserveBindingModel model);
+ bool Delete(ReserveBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteCostLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteCostLogic.cs
new file mode 100644
index 0000000..3cb82db
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteCostLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IRouteCostLogic
+ {
+ List? ReadList(RouteCostSearchModel? model);
+ RouteCostViewModel? ReadElement(RouteCostSearchModel model);
+ bool Create(RouteCostBindingModel model);
+ bool Update(RouteCostBindingModel model);
+ bool Delete(RouteCostBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteLogic.cs
new file mode 100644
index 0000000..29fe9dd
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IRouteLogic
+ {
+ List? ReadList(RouteSearchModel? model);
+ RouteViewModel? ReadElement(RouteSearchModel model);
+ bool Create(RouteBindingModel model);
+ bool Update(RouteBindingModel model);
+ bool Delete(RouteBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteReserveLogic.cs b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteReserveLogic.cs
new file mode 100644
index 0000000..4dec5c3
--- /dev/null
+++ b/JurassicZoo/ZooContracts/BusinessLogicsContracts/IRouteReserveLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.BusinessLogicsContracts
+{
+ public interface IRouteReserveLogic
+ {
+ List? ReadList(RouteReserveSearchModel? model);
+ RouteReserveViewModel? ReadElement(RouteReserveSearchModel model);
+ bool Create(RouteReserveBindingModel model);
+ bool Update(RouteReserveBindingModel model);
+ bool Delete(RouteReserveBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/Properties/launchSettings.json b/JurassicZoo/ZooContracts/Properties/launchSettings.json
new file mode 100644
index 0000000..f2a7238
--- /dev/null
+++ b/JurassicZoo/ZooContracts/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "profiles": {
+ "ZooContracts": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:53043;http://localhost:53045"
+ }
+ }
+}
\ No newline at end of file
diff --git a/JurassicZoo/ZooContracts/SearchModel/ClientSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/ClientSearchModel.cs
new file mode 100644
index 0000000..ec50a06
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/ClientSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class ClientSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ClientEmail { get; set; }
+ public string? ClientPassword { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/CostSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/CostSearchModel.cs
new file mode 100644
index 0000000..dababd1
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/CostSearchModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class CostSearchModel
+ {
+ public int? Id { get; set; }
+ public string CostName { get; set; }
+ public DateTime? DateTo { get; set; }
+ public DateTime? DateFrom { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/EmployeeSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/EmployeeSearchModel.cs
new file mode 100644
index 0000000..c6df959
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/EmployeeSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class EmployeeSearchModel
+ {
+ public int? Id { get; set; }
+ public string? EmployeeName { get; set; }
+ public int? EmployeePassword { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/PaymentSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/PaymentSearchModel.cs
new file mode 100644
index 0000000..019bc0a
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/PaymentSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class PaymentSearchModel
+ {
+ public int? Id { get; set; }
+ public int? RouteReserveId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/ReserveSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/ReserveSearchModel.cs
new file mode 100644
index 0000000..79cb22d
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/ReserveSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class ReserveSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ReserveName { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/RouteCostSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/RouteCostSearchModel.cs
new file mode 100644
index 0000000..abeaf5a
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/RouteCostSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class RouteCostSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/RouteReserveSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/RouteReserveSearchModel.cs
new file mode 100644
index 0000000..8b597df
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/RouteReserveSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class RouteReserveSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/SearchModel/RouteSearchModel.cs b/JurassicZoo/ZooContracts/SearchModel/RouteSearchModel.cs
new file mode 100644
index 0000000..e42f442
--- /dev/null
+++ b/JurassicZoo/ZooContracts/SearchModel/RouteSearchModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.SearchModel
+{
+ public class RouteSearchModel
+ {
+ public int? Id { get; set; }
+ public DateTime? DateFrom { get; set; }
+ public DateTime? DateTo { get; set; }
+ public int? ClientId { get; set; }
+ ///
+ /// Id выбранных маршрутов
+ ///
+ public List? SelectedRoutesIds { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IClientStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IClientStorage.cs
new file mode 100644
index 0000000..0e63c71
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IClientStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IClientStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ClientSearchModel model);
+ ClientViewModel GetElement(ClientSearchModel model);
+ ClientViewModel? Insert(ClientBindingModel model);
+ ClientViewModel? Update(ClientBindingModel model);
+ ClientViewModel? Delete(ClientBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/ICostStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/ICostStorage.cs
new file mode 100644
index 0000000..bf05702
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/ICostStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface ICostStorage
+ {
+ List GetFullList();
+ List GetFilteredList(CostSearchModel model);
+ CostViewModel GetElement(CostSearchModel model);
+ CostViewModel? Insert(CostBindingModel model);
+ CostViewModel? Update(CostBindingModel model);
+ CostViewModel? Delete(CostBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IEmployeeStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IEmployeeStorage.cs
new file mode 100644
index 0000000..83b92eb
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IEmployeeStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IEmployeeStorage
+ {
+ List GetFullList();
+ List GetFilteredList(EmployeeSearchModel model);
+ EmployeeViewModel GetElement(EmployeeSearchModel model);
+ EmployeeViewModel? Insert(EmployeeBindingModel model);
+ EmployeeViewModel? Update(EmployeeBindingModel model);
+ EmployeeViewModel? Delete(EmployeeBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IPaymentStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IPaymentStorage.cs
new file mode 100644
index 0000000..4adde25
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IPaymentStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IPaymentStorage
+ {
+ List GetFullList();
+ List GetFilteredList(PaymentSearchModel model);
+ PaymentViewModel GetElement(PaymentSearchModel model);
+ PaymentViewModel? Insert(PaymentBindingModel model);
+ PaymentViewModel? Update(PaymentBindingModel model);
+ PaymentViewModel? Delete(PaymentBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IReserveStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IReserveStorage.cs
new file mode 100644
index 0000000..9537b4e
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IReserveStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IReserveStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ReserveSearchModel model);
+ ReserveViewModel GetElement(ReserveSearchModel model);
+ ReserveViewModel? Insert(ReserveBindingModel model);
+ ReserveViewModel? Update(ReserveBindingModel model);
+ ReserveViewModel? Delete(ReserveBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IRouteCostStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IRouteCostStorage.cs
new file mode 100644
index 0000000..14ef653
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IRouteCostStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IRouteCostStorage
+ {
+ List GetFullList();
+ List GetFilteredList(RouteCostSearchModel model);
+ RouteCostViewModel GetElement(RouteCostSearchModel model);
+ RouteCostViewModel? Insert(RouteCostBindingModel model);
+ RouteCostViewModel? Update(RouteCostBindingModel model);
+ RouteCostViewModel? Delete(RouteCostBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IRouteReserveStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IRouteReserveStorage.cs
new file mode 100644
index 0000000..6790cd0
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IRouteReserveStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IRouteReserveStorage
+ {
+ List GetFullList();
+ List GetFilteredList(RouteReserveSearchModel model);
+ RouteReserveViewModel GetElement(RouteReserveSearchModel model);
+ RouteReserveViewModel? Insert(RouteReserveBindingModel model);
+ RouteReserveViewModel? Update(RouteReserveBindingModel model);
+ RouteReserveViewModel? Delete(RouteReserveBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/StoragesContracts/IRouteStorage.cs b/JurassicZoo/ZooContracts/StoragesContracts/IRouteStorage.cs
new file mode 100644
index 0000000..18fbfb2
--- /dev/null
+++ b/JurassicZoo/ZooContracts/StoragesContracts/IRouteStorage.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.ViewModels;
+
+namespace ZooContracts.StoragesContracts
+{
+ public interface IRouteStorage
+ {
+ List GetFullList();
+ List GetFilteredList(RouteSearchModel model);
+ List GetLessonRoutes(RouteSearchModel model);
+ RouteViewModel? GetElement(RouteSearchModel model);
+ RouteViewModel? Insert(RouteBindingModel model);
+ RouteViewModel? Update(RouteBindingModel model);
+ RouteViewModel? Delete(RouteBindingModel model);
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ClientViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ClientViewModel.cs
new file mode 100644
index 0000000..8dd0089
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ClientViewModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class ClientViewModel : IClientModel
+ {
+ public int Id { get; set; }
+ public string ClientName { get; set; } = string.Empty;
+ public string ClientEmail { get; set; } = string.Empty;
+ public string ClientPassword { get; set; } = string.Empty;
+ public string ClientPhone { get; set; } = string.Empty;
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/CostViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/CostViewModel.cs
new file mode 100644
index 0000000..519903c
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/CostViewModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ public class CostViewModel : ICostModel
+ {
+ public int Id { get; set; }
+ public string CostName { get; set; }
+ public double Sum { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/EmployeeViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/EmployeeViewModel.cs
new file mode 100644
index 0000000..2f63f79
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/EmployeeViewModel.cs
@@ -0,0 +1,18 @@
+using ZooDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class EmployeeViewModel : IEmployeeModel
+ {
+ public int Id { get; set; }
+ public string EmployeeName { get; set; } = string.Empty;
+ public string EmployeeEmail { get; set; } = string.Empty;
+ public string EmployeePhone { get; set; } = string.Empty;
+ public string EmployeePassword { get; set; } = string.Empty;
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/PaymentViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/PaymentViewModel.cs
new file mode 100644
index 0000000..217fe5a
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/PaymentViewModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ internal class PaymentViewModel : IPaymentModel
+ {
+ public int Id { get; set; }
+ public double PaySum { get; set; }
+ public DateTime? DateOfPayment { get; set; }
+ public int RouteReserveId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ReportCostViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ReportCostViewModel.cs
new file mode 100644
index 0000000..d4bd3b6
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ReportCostViewModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class ReportCostViewModel
+ {
+ [DisplayName("Название затраты")]
+ public string CostName { get; set; } = string.Empty;
+ [DisplayName("Сумма")]
+ public double Sum { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ReportReserveRoutesViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ReportReserveRoutesViewModel.cs
new file mode 100644
index 0000000..3d4d757
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ReportReserveRoutesViewModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class ReportReserveRoutesViewModel
+ {
+ public int ReserveId { get; set; }
+ public int RoutesCount { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ReportRouteReservesViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ReportRouteReservesViewModel.cs
new file mode 100644
index 0000000..6a43cde
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ReportRouteReservesViewModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class ReportRouteReservesViewModel
+ {
+ ///
+ /// Номер маршрута
+ ///
+ public int RouteId { get; set; }
+ ///
+ /// Заповедник в Маршруте
+ ///
+ public List RouteLessons { get; set; } = new();
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ReportViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ReportViewModel.cs
new file mode 100644
index 0000000..9e9a5b5
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ReportViewModel.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooContracts.ViewModels
+{
+ public class ReportViewModel
+ {
+ [DisplayName("Название маршрута")]
+ public int RouteNumber { get; set; }
+ [DisplayName("Дата записи")]
+ public DateTime Date { get; set; }
+ [DisplayName("Сумма затрат")]
+ public double Sum { get; set; }
+ [DisplayName("Кол-во заповедников")]
+ public int RouteCount { get; set; }
+ [DisplayName("Название затраты")]
+ public List Cost { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/ReserveViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/ReserveViewModel.cs
new file mode 100644
index 0000000..71567a9
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/ReserveViewModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ public class ReserveViewModel : IReserveModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название заповедника")]
+ public string ReserveName { get; set; } = string.Empty;
+ [DisplayName("стоимость посешения заповедника")]
+ public double ReservePrice { get; set; }
+ public int EmployeeId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/RouteCostViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/RouteCostViewModel.cs
new file mode 100644
index 0000000..5e4037f
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/RouteCostViewModel.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ public class RouteCostViewModel : IRouteCostModel
+ {
+ [DisplayName("Id маршрута")]
+ public int RouteId { get; set; }
+ [DisplayName("Id затраты")]
+ public int CostId { get; set; }
+ public int Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/RouteReserveViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/RouteReserveViewModel.cs
new file mode 100644
index 0000000..9b42da9
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/RouteReserveViewModel.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ public class RouteReserveViewModel : IRouteReserveModel
+ {
+ [DisplayName("Id маршрута")]
+ public int RouteId { get; set; }
+ [DisplayName("Id заповедника")]
+ public int ReserveId { get; set; }
+ public int Id { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ViewModels/RouteViewModel.cs b/JurassicZoo/ZooContracts/ViewModels/RouteViewModel.cs
new file mode 100644
index 0000000..771701b
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ViewModels/RouteViewModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+
+namespace ZooContracts.ViewModels
+{
+ public class RouteViewModel : IRouteModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Имя клиента")]
+ public string ClientName { get; set; } = string.Empty;
+ [DisplayName("Дата начала ")]
+ public DateTime DateStart { get; set; }
+ public int ClientId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooContracts/ZooContracts.csproj b/JurassicZoo/ZooContracts/ZooContracts.csproj
new file mode 100644
index 0000000..7ed3c00
--- /dev/null
+++ b/JurassicZoo/ZooContracts/ZooContracts.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/JurassicZoo/ZooDataModels/IId.cs b/JurassicZoo/ZooDataModels/IId.cs
new file mode 100644
index 0000000..0c8fca3
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/IId.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IClientModel.cs b/JurassicZoo/ZooDataModels/Models/IClientModel.cs
new file mode 100644
index 0000000..99745eb
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IClientModel.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IClientModel : IId
+ {
+ ///
+ /// Имя
+ ///
+ public string ClientName { get; }
+ ///
+ /// Почта
+ ///
+ public string ClientEmail { get; }
+ ///
+ /// Телефон
+ ///
+ public string ClientPhone { get; }
+ ///
+ /// Пароль
+ ///
+ public string ClientPassword { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/ICostModel.cs b/JurassicZoo/ZooDataModels/Models/ICostModel.cs
new file mode 100644
index 0000000..8a35e4b
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/ICostModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface ICostModel: IId
+ {
+ ///
+ /// Сумма затраты
+ ///
+ public double Sum { get; }
+ ///
+ /// Название
+ ///
+ public string CostName { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IEmployeeModel.cs b/JurassicZoo/ZooDataModels/Models/IEmployeeModel.cs
new file mode 100644
index 0000000..fa9bac0
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IEmployeeModel.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IEmployeeModel : IId
+ {
+ ///
+ /// Имя
+ ///
+ public string EmployeeName { get; set; }
+ ///
+ /// Почта
+ ///
+ public string EmployeeEmail { get; set; }
+ ///
+ /// Телефон
+ ///
+ public string EmployeePhone { get; set; }
+ ///
+ /// Пароль
+ ///
+ public string EmployeePassword { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IPaymentModel.cs b/JurassicZoo/ZooDataModels/Models/IPaymentModel.cs
new file mode 100644
index 0000000..e106baa
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IPaymentModel.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IPaymentModel : IId
+ {
+ ///
+ /// Оплаченная сумма
+ ///
+ public double PaySum { get; set; }
+ ///
+ /// Дата платежа
+ ///
+ public DateTime? DateOfPayment { get; set; }
+ ///
+ /// Id заповедника маршрута
+ ///
+ public int RouteReserveId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IReserveModel.cs b/JurassicZoo/ZooDataModels/Models/IReserveModel.cs
new file mode 100644
index 0000000..b9a73ca
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IReserveModel.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IReserveModel : IId
+ {
+ ///
+ /// Название
+ ///
+ public string ReserveName { get; set; }
+ ///
+ /// Стоимость
+ ///
+ public double ReservePrice { get; set; }
+ ///
+ /// Id Сотрудника
+ ///
+ public int EmployeeId { get; set; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IRouteCostModel.cs b/JurassicZoo/ZooDataModels/Models/IRouteCostModel.cs
new file mode 100644
index 0000000..b00ff00
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IRouteCostModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IRouteCostModel : IId
+ {
+ ///
+ /// Id маршрута
+ ///
+ public int RouteId { get; }
+ ///
+ /// Id затрат
+ ///
+ public int CostId { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IRouteModel.cs b/JurassicZoo/ZooDataModels/Models/IRouteModel.cs
new file mode 100644
index 0000000..02f9a59
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IRouteModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IRouteModel : IId
+ {
+ ///
+ /// Дата начала
+ ///
+ public DateTime DateStart { get; }
+ ///
+ /// Id клиента
+ ///
+ public int ClientId { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Models/IRouteReserveModel.cs b/JurassicZoo/ZooDataModels/Models/IRouteReserveModel.cs
new file mode 100644
index 0000000..d83d436
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Models/IRouteReserveModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZooDataModels.Models
+{
+ public interface IRouteReserveModel : IId
+ {
+ ///
+ /// Id маршрута
+ ///
+ public int RouteId { get; }
+ /// ///
+ /// Id заповедника
+ ///
+ public int ReserveId { get; }
+ }
+}
diff --git a/JurassicZoo/ZooDataModels/Properties/launchSettings.json b/JurassicZoo/ZooDataModels/Properties/launchSettings.json
new file mode 100644
index 0000000..9c0e1be
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "profiles": {
+ "ZooDataModels": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:53044;http://localhost:53046"
+ }
+ }
+}
\ No newline at end of file
diff --git a/JurassicZoo/ZooDataModels/ZooDataModels.csproj b/JurassicZoo/ZooDataModels/ZooDataModels.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/JurassicZoo/ZooDataModels/ZooDataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/ClientStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/ClientStorage.cs
new file mode 100644
index 0000000..18e89a5
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/ClientStorage.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class ClientStorage : IClientStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Clients
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(ClientSearchModel model)
+ {
+ if (model == null)
+ {
+ return new();
+ }
+ if (model.Id.HasValue)
+ {
+ var res = GetElement(model);
+ return res != null ? new() { res } : new();
+ }
+ if (model.ClientEmail != null)
+ {
+ using var context = new ZooDatabase();
+ return context.Clients
+ .Where(rec => rec.ClientEmail.Contains(model.ClientEmail))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ return new();
+ }
+ public ClientViewModel? GetElement(ClientSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)
+ return context.Clients.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ if (model.ClientEmail != null && model.ClientPassword != null)
+ return context.Clients
+ .FirstOrDefault(x => x.ClientEmail == model.ClientEmail
+ && x.ClientPassword == model.ClientPassword)?.GetViewModel;
+ if (model.ClientEmail != null)
+ return context.Clients.FirstOrDefault(x => x.ClientEmail == model.ClientEmail)?.GetViewModel;
+ return null;
+ }
+ public ClientViewModel? Insert(ClientBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ if (model == null)
+ {
+ return null;
+ }
+ var newClient = Client.Create(model);
+ if (newClient == null)
+ {
+ return null;
+ }
+ context.Clients.Add(newClient);
+ context.SaveChanges();
+ return newClient.GetViewModel;
+ }
+ public ClientViewModel? Update(ClientBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var res = context.Clients.FirstOrDefault(x => x.Id == model.Id);
+ res?.Update(model);
+ context.SaveChanges();
+ return res?.GetViewModel;
+ }
+ public ClientViewModel? Delete(ClientBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var res = context.Clients.FirstOrDefault(x => x.Id == model.Id);
+ if (res != null)
+ {
+ context.Clients.Remove(res);
+ context.SaveChanges();
+ }
+ return res?.GetViewModel;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/CostStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/CostStorage.cs
new file mode 100644
index 0000000..8e8d1c7
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/CostStorage.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.StoragesContracts;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class CostStorage : ICostStorage
+ {
+ public CostViewModel? Delete(CostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var element = context.Costs.FirstOrDefault(x => x.Id == model.Id);
+ if (element != null)
+ {
+ context.Costs.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+
+ public CostViewModel GetElement(CostSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)//сначала ищем по Id
+ {
+ return context.Costs
+ .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+ if (!string.IsNullOrEmpty(model.CostName))//затем по названию
+ {
+ return context.Costs
+ .FirstOrDefault(x => x.CostName == model.CostName)?.GetViewModel;
+ }
+ return null;
+ }
+
+ public List GetFilteredList(CostSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ return context.Costs
+ .Where(x => x.Id == model.Id)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Costs
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public CostViewModel? Insert(CostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var newCost = Cost.Create(model);
+ if (newCost == null)
+ {
+ return null;
+ }
+ context.Costs.Add(newCost);
+ context.SaveChanges();
+ return newCost.GetViewModel;
+ }
+
+ public CostViewModel? Update(CostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var Cost = context.Costs.FirstOrDefault(x => x.Id == model.Id);
+ if (Cost == null)
+ {
+ return null;
+ }
+ Cost.Update(model);
+ context.SaveChanges();
+ return Cost.GetViewModel;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/EmployeeStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/EmployeeStorage.cs
new file mode 100644
index 0000000..ea606f5
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/EmployeeStorage.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.StoragesContracts;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class EmployeeStorage : IEmployeeStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Employees
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(EmployeeSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ if (model.Id.HasValue)
+ {
+ var res = GetElement(model);
+ return res != null ? new() { res } : new();
+ }
+ if (model.EmployeeName != null)
+ {
+ using var context = new ZooDatabase();
+ return context.Employees
+ .Where(rec => rec.EmployeeName.Contains(model.EmployeeName))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ return new();
+ }
+ public CostViewModel? GetElement(EmployeeSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)
+ return context.Employees.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ if (model.EmployeeName != null && model.EmployeePassword != null)
+ return context.Employees
+ .FirstOrDefault(x => x.EmployeeName.Equals(model.EmployeeName)
+ && x.EmployeePassword.Equals(model.EmployeePassword))
+ ?.GetViewModel;
+ if (model.EmployeeName != null)
+ return context.Employees.FirstOrDefault(x => x.EmployeeName.Contains(model.EmployeeName))?.GetViewModel;
+ return null;
+ }
+ public CostViewModel? Insert(EmployeeBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var res = Employee.Create(model);
+ if (res != null)
+ {
+ context.Employees.Add(res);
+ context.SaveChanges();
+ }
+ return res?.GetViewModel;
+ }
+ public CostViewModel? Update(EmployeeBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var res = context.Employees.FirstOrDefault(x => x.Id == model.Id);
+ res?.Update(model);
+ context.SaveChanges();
+ return res?.GetViewModel;
+ }
+ public CostViewModel? Delete(EmployeeBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var res = context.Employees.FirstOrDefault(x => x.Id == model.Id);
+ if (res != null)
+ {
+ context.Employees.Remove(res);
+ context.SaveChanges();
+ }
+ return res?.GetViewModel;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/PaymentStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/PaymentStorage.cs
new file mode 100644
index 0000000..e389136
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/PaymentStorage.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.StoragesContracts;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class PaymentStorage : IPaymentStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Payments
+ .Include(rec => rec.RouteReserve)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFilteredList(PaymentSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ var list = context.Payments.Where(x => x.RouteReserveId == model.RouteReserveId)
+ .OrderBy(x => x.DateOfPayment)
+ .Include(x => x.RouteReserve);
+ return list
+ .Select(x => new PaymentViewModel
+ {
+ DateOfPayment = x.DateOfPayment,
+ Id = x.Id,
+ PaySum = x.PaySum,
+ RouteReserveId = x.RouteReserveId
+ })
+ .ToList();
+ }
+ public PaymentViewModel GetElement(PaymentSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ {
+ var payment = context.Payments.Include(x => x.RouteReserve)
+ .FirstOrDefault(x => x.RouteReserveId == model.RouteReserveId);
+ return payment != null ? new PaymentViewModel
+ {
+ DateOfPayment = payment.DateOfPayment,
+ Id = payment.Id,
+ PaySum = payment.PaySum,
+ RouteReserveId = payment.RouteReserveId
+ } :
+ null;
+ }
+ }
+ public PaymentViewModel? Insert(PaymentBindingModel model)
+ {
+ var context = new ZooDatabase();
+ var newPayment = Payment.Create(context, model);
+ if (newPayment == null)
+ {
+ return null;
+ }
+ context.Payments.Add(newPayment);
+ context.SaveChanges();
+ return newPayment.GetViewModel;
+ }
+
+ public PaymentViewModel? Update(PaymentBindingModel model)
+ {
+ var context = new ZooDatabase();
+ var element = context.Payments.
+ Include(x => x.RouteReserve)
+ .FirstOrDefault(rec => rec.Id == model.Id);
+ if (element == null)
+ {
+ throw new Exception("Оплата не найдена");
+ }
+ element.Update(model);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ public PaymentViewModel? Delete(PaymentBindingModel model)
+ {
+ var context = new ZooDatabase();
+
+ var element = context.Payments
+ .Include(x => x.RouteReserve)
+ .FirstOrDefault(rec => rec.Id == model.Id);
+ if (element != null)
+ {
+ context.Payments.Remove(element);
+ context.SaveChanges();
+ return element?.GetViewModel;
+ }
+ else
+ {
+ throw new Exception("Оплата не найдена");
+ }
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/ReserveStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/ReserveStorage.cs
new file mode 100644
index 0000000..8165385
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/ReserveStorage.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.StoragesContracts;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class ReserveStorage : IReserveStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Reserves
+ .Include(x => x.Employee)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(ReserveSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ return context.Reserves
+ .Where(x => x.Id == model.Id)
+ .Include(x => x.Employee)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public ReserveViewModel? GetElement(ReserveSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)//сначала ищем по Id
+ {
+ return context.Reserves
+ .Include(x => x.Employee)
+ .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+ if (!string.IsNullOrEmpty(model.ReserveName))//ищем по названию
+ {
+ return context.Reserves
+ .Include(x => x.Employee)
+ .FirstOrDefault(x => x.ReserveName == model.ReserveName)?.GetViewModel;
+ }
+ return null;
+ }
+ public ReserveViewModel? Insert(ReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var newReserve = Reserve.Create(context, model);
+ if (newReserve == null)
+ {
+ return null;
+ }
+ context.Reserves.Add(newReserve);
+ context.SaveChanges();
+ return newReserve.GetViewModel;
+ }
+ public ReserveViewModel? Update(ReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var Reserve = context.Reserves.FirstOrDefault(x => x.Id == model.Id);
+ if (Reserve == null)
+ {
+ return null;
+ }
+ Reserve.Update(model);
+ context.SaveChanges();
+ return Reserve.GetViewModel;
+ }
+ public ReserveViewModel? Delete(ReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var element = context.Reserves.FirstOrDefault(x => x.Id == model.Id);
+ if (element != null)
+ {
+ context.Reserves.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/RouteCostStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/RouteCostStorage.cs
new file mode 100644
index 0000000..2397f32
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/RouteCostStorage.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class RouteCostStorage : IRouteCostStorage
+ {
+ public RouteCostViewModel? Delete(RouteCostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var RouteCost = context.RouteCosts.FirstOrDefault(rec => rec.Id == model.Id);
+ if (RouteCost != null)
+ {
+ context.RouteCosts.Remove(RouteCost);
+ context.SaveChanges();
+ return RouteCost.GetViewModel;
+ }
+ return null;
+ }
+
+ public RouteCostViewModel GetElement(RouteCostSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)
+ {
+ return context.RouteCosts.Include(x => x.Route)
+ .Include(x => x.Cost)
+ .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+ return null;
+ }
+
+ public List GetFilteredList(RouteCostSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ return context.RouteCosts
+ .Where(x => x.Id == model.Id)
+ .Include(x => x.Route)
+ .Include(x => x.Cost)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.RouteCosts
+ .Include(x => x.Route)
+ .Include(x => x.Cost)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public RouteCostViewModel? Insert(RouteCostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var newRouteCost = RouteCost.Create(context, model);
+ if (newRouteCost == null)
+ {
+ return null;
+ }
+ context.RouteCosts.Add(newRouteCost);
+ context.SaveChanges();
+ return newRouteCost.GetViewModel;
+ }
+
+ public RouteCostViewModel? Update(RouteCostBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var RouteCost = context.RouteCosts.FirstOrDefault(x => x.Id == model.Id);
+ if (RouteCost == null)
+ {
+ return null;
+ }
+ RouteCost.Update(model);
+ context.SaveChanges();
+ return RouteCost.GetViewModel;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/RouteReserveStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/RouteReserveStorage.cs
new file mode 100644
index 0000000..ef9aece
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/RouteReserveStorage.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class RouteReserveStorage : IRouteReserveStorage
+ {
+ public RouteReserveViewModel? Delete(RouteReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var RouteReserve = context.RouteReserves.FirstOrDefault(rec => rec.Id == model.Id);
+ if (RouteReserve != null)
+ {
+ context.RouteReserves.Remove(RouteReserve);
+ context.SaveChanges();
+ return RouteReserve.GetViewModel;
+ }
+ return null;
+ }
+
+ public RouteReserveViewModel? GetElement(RouteReserveSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)
+ {
+ return context.RouteReserves.Include(x => x.Route)
+ .Include(x => x.Reserve)
+ .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+ return null;
+ }
+
+ public List GetFilteredList(RouteReserveSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ return context.RouteReserves
+ .Where(x => x.Id == model.Id)
+ .Include(x => x.Route)
+ .Include(x => x.Reserve)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.RouteReserves
+ .Include(x => x.Route)
+ .Include(x => x.Reserve)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public RouteReserveViewModel? Insert(RouteReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var newRouteReserve = RouteReserve.Create(context, model);
+ if (newRouteReserve == null)
+ {
+ return null;
+ }
+ context.RouteReserves.Add(newRouteReserve);
+ context.SaveChanges();
+ return newRouteReserve.GetViewModel;
+ }
+
+ public RouteReserveViewModel? Update(RouteReserveBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var RouteReserve = context.RouteReserves.FirstOrDefault(x => x.Id == model.Id);
+ if (RouteReserve == null)
+ {
+ return null;
+ }
+ RouteReserve.Update(model);
+ context.SaveChanges();
+ return RouteReserve.GetViewModel;
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Implements/RouteStorage.cs b/JurassicZoo/ZooDatabaseImplements/Implements/RouteStorage.cs
new file mode 100644
index 0000000..150200e
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Implements/RouteStorage.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.SearchModel;
+using ZooContracts.StoragesContracts;
+using ZooContracts.ViewModels;
+using ZooDatabaseImplements;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements.Implements
+{
+ public class RouteStorage : IRouteStorage
+ {
+ public List GetFullList()
+ {
+ using var context = new ZooDatabase();
+ return context.Routes
+ .Include(x => x.Client)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ public List GetFilteredList(RouteSearchModel model)
+ {
+ using var context = new ZooDatabase();
+ if (model.DateFrom.HasValue && model.DateTo.HasValue) // если не ищем по id, значит ищем по диапазону дат
+ {
+ return context.Routes
+ .Where(x => model.DateFrom <= x.DateStart.Date && x.DateStart <= model.DateTo)
+ .Include(x => x.Client)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ if (model.ClientId.HasValue)
+ {
+ return context.Routes
+ .Where(x => x.Client.Id == model.ClientId)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ return new();
+ }
+ public RouteViewModel? GetElement(RouteSearchModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ using var context = new ZooDatabase();
+ if (model.Id.HasValue)
+ {
+ return context.Routes.Include(x => x.Client)
+ .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
+ }
+ return null;
+ }
+ public RouteViewModel? Insert(RouteBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var newRoute = Route.Create(context, model);
+ if (newRoute == null)
+ {
+ return null;
+ }
+ context.Routes.Add(newRoute);
+ context.SaveChanges();
+ return newRoute.GetViewModel;
+ }
+ public RouteViewModel? Update(RouteBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var Route = context.Routes.FirstOrDefault(x => x.Id == model.Id);
+ if (Route == null)
+ {
+ return null;
+ }
+ Route.Update(model);
+ context.SaveChanges();
+ return Route.GetViewModel;
+ }
+ public RouteViewModel? Delete(RouteBindingModel model)
+ {
+ using var context = new ZooDatabase();
+ var Route = context.Routes.FirstOrDefault(rec => rec.Id == model.Id);
+ if (Route != null)
+ {
+ context.Routes.Remove(Route);
+ context.SaveChanges();
+ return Route.GetViewModel;
+ }
+ return null;
+ }
+
+ public List GetReserveRoutes(RouteSearchModel model)
+ {
+ if (model.SelectedRoutesIds == null)
+ {
+ return new();
+ }
+ using var context = new ZooDatabase();
+ return context.Routes
+ .Where(c => model.SelectedRoutesIds.Contains(c.Id))
+ .Select(c => new ReportRouteReservesViewModel()
+ {
+ RouteReserves = GetRouteReserves(context, new() { Id = c.Id })
+ })
+ .ToList();
+ }
+ ///
+ /// Получение списка заповедников по выбранному маршруту
+ ///
+ ///
+ ///
+ private static List GetRouteReserves(ZooDatabase context, RouteSearchModel model)
+ {
+ return context.Routes
+ .Include(wir => wir.RouteReserves)
+ .Where(wir => wir.Id == model.Id)
+ .Select(wir => new ReportReserveRoutesViewModel()
+ {
+ ReserveId = wir.RouteReserves.Id
+ })
+ .ToList();
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Client.cs b/JurassicZoo/ZooDatabaseImplements/Models/Client.cs
new file mode 100644
index 0000000..fa9f727
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Client.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using ZooDataModels.Models;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Client : IClientModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string ClientName { get; private set; } = string.Empty;
+ [Required]
+ public string ClientPhone { get; private set; } = string.Empty;
+ [Required]
+ public string ClientPassword { get; private set; } = string.Empty;
+ [Required]
+ public string ClientEmail { get; private set; } = string.Empty;
+ [ForeignKey("ClientId")]
+ public virtual List Routes { get; set; } = new();
+ public static Client? Create(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new()
+ {
+ Id = model.Id,
+ ClientName = model.ClientName,
+ ClientEmail = model.ClientEmail,
+ ClientPassword = model.ClientPassword,
+ ClientPhone = model.ClientPhone
+ };
+ }
+ public void Update(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ClientName = model.ClientName;
+ ClientEmail = model.ClientEmail;
+ ClientPassword = model.ClientPassword;
+ ClientPhone = model.ClientPhone;
+ }
+ public ClientViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ClientName = ClientName,
+ ClientEmail = ClientEmail,
+ ClientPassword = ClientPassword,
+ ClientPhone = ClientPhone
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Cost.cs b/JurassicZoo/ZooDatabaseImplements/Models/Cost.cs
new file mode 100644
index 0000000..e291a64
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Cost.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Cost : ICostModel
+ {
+ public int Id { get; private set; }
+ public string CostName { get; private set; } = string.Empty;
+ [Required]
+ public double Sum { get; private set; }
+ [ForeignKey("CostId")]
+ public virtual List RouteCosts { get; set; } = new();
+ public static Cost? Create(CostBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new()
+ {
+ Id = model.Id,
+ CostName = model.CostName,
+ Sum = model.Sum
+ };
+ }
+ public void Update(CostBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ CostName = model.CostName;
+ Sum = model.Sum;
+ }
+
+ public CostViewModel GetViewModel => new()
+ {
+ Id = Id,
+ CostName = CostName,
+ Sum = Sum
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Employee.cs b/JurassicZoo/ZooDatabaseImplements/Models/Employee.cs
new file mode 100644
index 0000000..a063ed6
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Employee.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using ZooDataModels.Models;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Employee : IEmployeeModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public string EmployeePhone { get; set; } = string.Empty;
+ [Required]
+ public string EmployeeEmail { get; set; } = string.Empty;
+ [Required]
+ public string EmployeePassword { get; set; } = string.Empty;
+ [Required]
+ public string EmployeeName { get; set; } = string.Empty;
+ [ForeignKey("EmployeeId")]
+ public virtual List Reserves { get; set; } = new();
+ public static Employee? Create(EmployeeBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new()
+ {
+ Id = model.Id,
+ EmployeeName = model.EmployeeName,
+ EmployeeEmail = model.EmployeeEmail,
+ EmployeePassword = model.EmployeePassword,
+ EmployeePhone = model.EmployeePhone
+ };
+ }
+ public void Update(EmployeeBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ EmployeeName = model.EmployeeName;
+ EmployeeEmail = model.EmployeeEmail;
+ EmployeePassword = model.EmployeePassword;
+ EmployeePhone = model.EmployeePhone;
+ }
+
+ public CostViewModel GetViewModel => new()
+ {
+ Id = Id
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Payment.cs b/JurassicZoo/ZooDatabaseImplements/Models/Payment.cs
new file mode 100644
index 0000000..41913e8
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Payment.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using ZooDataModels.Models;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Payment : IPaymentModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public int RouteReserveId { get; private set; }
+ [Required]
+ public double PaySum { get; private set; }
+ [Required]
+ public DateTime? DateOfPayment { get; private set; } = DateTime.Now;
+ public virtual RouteReserve RouteReserve { get; private set; } = new();
+ public static Payment? Create(ZooDatabase context, PaymentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+
+ return new Payment()
+ {
+ Id = model.Id,
+ RouteReserve = context.RouteReserves.First(x => x.Id == model.RouteReserveId),
+ PaySum = model.PaySum,
+ DateOfPayment = model.DateOfPayment
+ };
+ }
+ public void Update(PaymentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Id = model.Id;
+ RouteReserveId = model.RouteReserveId;
+ PaySum = model.PaySum;
+ DateOfPayment = model.DateOfPayment;
+ }
+
+
+ public PaymentViewModel GetViewModel
+ {
+ get
+ {
+ var context = new ZooDatabase();
+ return new()
+ {
+ Id = Id,
+ RouteReserveId = RouteReserveId,
+ PaySum = PaySum,
+ DateOfPayment = DateOfPayment
+ };
+ }
+ }
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Reserve.cs b/JurassicZoo/ZooDatabaseImplements/Models/Reserve.cs
new file mode 100644
index 0000000..395648e
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Reserve.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Reserve : IReserveModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string ReserveName { get; private set; } = string.Empty;
+ [Required]
+ public double ReservePrice { get; private set; }
+ [Required]
+ public int EmployeeId { get; private set; }
+ public virtual Employee Employee { get; private set; } = new();
+ [ForeignKey("ReserveId")]
+ public virtual List RouteReserves { get; set; } = new();
+ [ForeignKey("ReserveId")]
+ public virtual List Payments { get; set; } = new();
+ public static Reserve? Create(ZooDatabase context, ReserveBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Reserve()
+ {
+ Id = model.Id,
+ ReserveName = model.ReserveName,
+ ReservePrice = model.ReservePrice,
+ Employee = context.Employees.First(x => x.Id == model.EmployeeId)
+ };
+ }
+ public static Reserve Create(ReserveViewModel model)
+ {
+ return new Reserve
+ {
+ Id = model.Id,
+ ReserveName = model.ReserveName,
+ ReservePrice = model.ReservePrice,
+ EmployeeId = model.EmployeeId
+ };
+ }
+ public void Update(ReserveBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ReserveName = model.ReserveName;
+ ReservePrice = model.ReservePrice;
+ EmployeeId = model.EmployeeId;
+ }
+ public ReserveViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ReserveName = ReserveName,
+ ReservePrice = ReservePrice,
+ EmployeeId = EmployeeId
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/Route.cs b/JurassicZoo/ZooDatabaseImplements/Models/Route.cs
new file mode 100644
index 0000000..bbfb837
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/Route.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooDataModels.Models;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class Route : IRouteModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public DateTime DateStart { get; private set; } = DateTime.Now;
+ [Required]
+ public int ClientId { get; private set; }
+ public virtual Client Client { get; private set; } = new();
+ [ForeignKey("RouteId")]
+ public virtual RouteReserve RouteReserves { get; set; } = new();
+ [ForeignKey("RouteId")]
+ public virtual List RouteCosts { get; set; } = new();
+ public static Route Create(ZooDatabase context, RouteBindingModel model)
+ {
+ return new Route()
+ {
+ Id = model.Id,
+ DateStart = model.DateStart,
+ Client = context.Clients.First(x => x.Id == model.ClientId)
+ };
+ }
+
+ public void Update(RouteBindingModel model)
+ {
+ Id = model.Id;
+ DateStart = model.DateStart;
+ ClientId = model.ClientId;
+ }
+
+ public RouteViewModel GetViewModel => new()
+ {
+ Id = Id,
+ DateStart = DateStart,
+ ClientId = ClientId,
+ ClientName = Client.ClientName
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/RouteCost.cs b/JurassicZoo/ZooDatabaseImplements/Models/RouteCost.cs
new file mode 100644
index 0000000..a71a263
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/RouteCost.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using ZooDataModels.Models;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class RouteCost : IRouteCostModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public int CostId { get; set; }
+ [Required]
+ public int RouteId { get; set; }
+ public virtual Cost Cost { get; set; } = new();
+ public virtual Route Route { get; set; } = new();
+ public static RouteCost? Create(ZooDatabase context, RouteCostBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new()
+ {
+ Id = model.Id,
+ Route = context.Routes.First(x => x.Id == model.RouteId),
+ Cost = context.Costs.First(x => x.Id == model.CostId)
+ };
+ }
+ public void Update(RouteCostBindingModel model)
+ {
+ Id = model.Id;
+ }
+
+ public RouteCostViewModel GetViewModel => new()
+ {
+ Id = Id
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/Models/RouteReserve.cs b/JurassicZoo/ZooDatabaseImplements/Models/RouteReserve.cs
new file mode 100644
index 0000000..4fc56ad
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/Models/RouteReserve.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZooContracts.BindingModels;
+using ZooContracts.ViewModels;
+using ZooDataModels.Models;
+
+namespace ZooDatabaseImplements.Models
+{
+ public class RouteReserve : IRouteReserveModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public int RouteId { get; set; }
+ [Required]
+ public int ReserveId { get; set; }
+ [Required]
+ public int Count { get; set; }
+ public virtual Reserve Reserve { get; set; } = new();
+ public virtual Route Route { get; set; } = new();
+ [ForeignKey("RouteReserveId")]
+ public virtual List Payments { get; set; } = new();
+ public static RouteReserve Create(ZooDatabase context, RouteReserveBindingModel model)
+ {
+ return new RouteReserve()
+ {
+ Id = model.Id,
+ Route = context.Routes.First(x => x.Id == model.RouteId),
+ Reserve = context.Reserves.First(x => x.Id == model.ReserveId)
+ };
+ }
+
+ public void Update(RouteReserveBindingModel model)
+ {
+ Id = model.Id;
+ }
+
+ public RouteReserveViewModel GetViewModel => new()
+ {
+ Id = Id
+ };
+ }
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/ZooDatabase.cs b/JurassicZoo/ZooDatabaseImplements/ZooDatabase.cs
new file mode 100644
index 0000000..1fb7e73
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/ZooDatabase.cs
@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore;
+using ZooDatabaseImplement.Models;
+using System.Collections.Generic;
+using ZooDatabaseImplements.Models;
+
+namespace ZooDatabaseImplements
+{
+ public class ZooDatabase : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (optionsBuilder.IsConfigured == false)
+ {
+ optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-5NJEOK79\SQLEXPRESS;Database=SchoolDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
+ }
+ base.OnConfiguring(optionsBuilder);
+
+ }
+ public virtual DbSet Clients { set; get; }
+ public virtual DbSet RouteReserves { set; get; }
+ public virtual DbSet Employees { set; get; }
+ public virtual DbSet Payments { set; get; }
+ public virtual DbSet Costs { set; get; }
+ public virtual DbSet Routes { set; get; }
+ public virtual DbSet Reserves { set; get; }
+ public virtual DbSet RouteCosts { set; get; }
+ }
+}
+}
diff --git a/JurassicZoo/ZooDatabaseImplements/ZooDatabaseImplements.csproj b/JurassicZoo/ZooDatabaseImplements/ZooDatabaseImplements.csproj
new file mode 100644
index 0000000..42b16fb
--- /dev/null
+++ b/JurassicZoo/ZooDatabaseImplements/ZooDatabaseImplements.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+