diff --git a/AutoRepairShop/AutoRepairShop.sln b/AutoRepairShop/AutoRepairShop.sln
index db362aa..bb5e326 100644
--- a/AutoRepairShop/AutoRepairShop.sln
+++ b/AutoRepairShop/AutoRepairShop.sln
@@ -5,6 +5,16 @@ VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRepairShop", "AutoRepairShop\AutoRepairShop.csproj", "{E8434326-6476-45B5-9EA4-8EC82479B8CA}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRepairShopBusinessLogic", "AutoRepairShopBusinessLogic\AutoRepairShopBusinessLogic.csproj", "{20D4586B-D87D-4BD1-8840-C7EADFBADF85}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRepairShopContracts", "AutoRepairShopContracts\AutoRepairShopContracts.csproj", "{315E839A-4DB8-4E0D-BFC1-19684FC53D07}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRepairShopDataModels", "AutoRepairShopDataModels\AutoRepairShopDataModels.csproj", "{D279E3B7-D840-4B28-B9ED-DDD81804DF71}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRepairShopDatabaseImplement", "AutoRepairShopDatabaseImplement\AutoRepairShopDatabaseImplement.csproj", "{208B8AB2-3C23-49E8-BB82-A8DFBD7849A6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRepairShopView", "AutoRepairShopView\AutoRepairShopView.csproj", "{11B9EC2E-9CA7-454E-8872-19AD291AC2A6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +25,26 @@ Global
{E8434326-6476-45B5-9EA4-8EC82479B8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8434326-6476-45B5-9EA4-8EC82479B8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8434326-6476-45B5-9EA4-8EC82479B8CA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {20D4586B-D87D-4BD1-8840-C7EADFBADF85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {20D4586B-D87D-4BD1-8840-C7EADFBADF85}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {20D4586B-D87D-4BD1-8840-C7EADFBADF85}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {20D4586B-D87D-4BD1-8840-C7EADFBADF85}.Release|Any CPU.Build.0 = Release|Any CPU
+ {315E839A-4DB8-4E0D-BFC1-19684FC53D07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {315E839A-4DB8-4E0D-BFC1-19684FC53D07}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {315E839A-4DB8-4E0D-BFC1-19684FC53D07}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {315E839A-4DB8-4E0D-BFC1-19684FC53D07}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D279E3B7-D840-4B28-B9ED-DDD81804DF71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D279E3B7-D840-4B28-B9ED-DDD81804DF71}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D279E3B7-D840-4B28-B9ED-DDD81804DF71}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D279E3B7-D840-4B28-B9ED-DDD81804DF71}.Release|Any CPU.Build.0 = Release|Any CPU
+ {208B8AB2-3C23-49E8-BB82-A8DFBD7849A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {208B8AB2-3C23-49E8-BB82-A8DFBD7849A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {208B8AB2-3C23-49E8-BB82-A8DFBD7849A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {208B8AB2-3C23-49E8-BB82-A8DFBD7849A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {11B9EC2E-9CA7-454E-8872-19AD291AC2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {11B9EC2E-9CA7-454E-8872-19AD291AC2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {11B9EC2E-9CA7-454E-8872-19AD291AC2A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {11B9EC2E-9CA7-454E-8872-19AD291AC2A6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/AutoRepairShopBusinessLogic.csproj b/AutoRepairShop/AutoRepairShopBusinessLogic/AutoRepairShopBusinessLogic.csproj
new file mode 100644
index 0000000..755eac1
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/AutoRepairShopBusinessLogic.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ClientLogic.cs b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ClientLogic.cs
new file mode 100644
index 0000000..12f8ec8
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ClientLogic.cs
@@ -0,0 +1,113 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopBusinessLogic.BusinessLogic
+{
+ 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. Email: {Email} Id:{ Id}", model.JobTitle, model.Id);
+ var element = _clientStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(ClientSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Email: {Email}. Id:{ Id}", model?.JobTitle, 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 ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ClientFIO))
+ {
+ throw new ArgumentNullException("Нет ФИО пользователя",
+ nameof(model.ClientFIO));
+ }
+ if (string.IsNullOrEmpty(model.JobTitle))
+ {
+ throw new ArgumentNullException("Нет должности пользователя",
+ nameof(model.JobTitle));
+ }
+ _logger.LogInformation("Component. ClientFIO:{ClientFIO}. Email:{ Email}. Id: { Id}", model.ClientFIO, model.JobTitle, model.Id);
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ManagerLogic.cs b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ManagerLogic.cs
new file mode 100644
index 0000000..4525ab0
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/ManagerLogic.cs
@@ -0,0 +1,123 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopBusinessLogic.BusinessLogic
+{
+ public class ManagerLogic : IManagerLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IManagerStorage _managerStorage;
+
+ public ManagerLogic(ILogger logger, IManagerStorage managerStorage)
+ {
+ _logger = logger;
+ _managerStorage = managerStorage;
+ }
+
+ public bool Create(ManagerBindingModel model)
+ {
+ CheckModel(model);
+ if (_managerStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(ManagerBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_managerStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public ManagerViewModel? ReadElement(ManagerSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Email: {Email} Id:{ Id}", model.Email, model.Id);
+ var element = _managerStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(ManagerSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Email: {Email}. Id:{ Id}", model?.Email, model?.Id);
+ var list = model == null ? _managerStorage.GetFullList() : _managerStorage.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(ManagerBindingModel model)
+ {
+ CheckModel(model);
+ if (_managerStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(ManagerBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ManagerFIO))
+ {
+ throw new ArgumentNullException("Нет ФИО пользователя",
+ nameof(model.ManagerFIO));
+ }
+ if (string.IsNullOrEmpty(model.Email))
+ {
+ throw new ArgumentNullException("Нет почтового адреса пользователя",
+ nameof(model.Email));
+ }
+ if (string.IsNullOrEmpty(model.Password))
+ {
+ throw new ArgumentNullException("Нет пароля пользователя",
+ nameof(model.Password));
+ }
+ _logger.LogInformation("Component. ManagerFIO:{ManagerFIO}. Email:{ Email}. Id: { Id}", model.ManagerFIO, model.Email, model.Id);
+ var element = _managerStorage.GetElement(new ManagerSearchModel { Email = model.Email });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Пользователь с таким логином уже есть");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/PointLogic.cs b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/PointLogic.cs
new file mode 100644
index 0000000..90a2578
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/PointLogic.cs
@@ -0,0 +1,107 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopBusinessLogic.BusinessLogic
+{
+ public class PointLogic : IPointLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IPointStorage _pointStorage;
+
+ public PointLogic(ILogger logger, IPointStorage pointStorage)
+ {
+ _logger = logger;
+ _pointStorage = pointStorage;
+ }
+
+ public bool Create(PointBindingModel model)
+ {
+ CheckModel(model);
+ if (_pointStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(PointBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_pointStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public PointViewModel? ReadElement(PointSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
+ var element = _pointStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(PointSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
+ var list = model == null ? _pointStorage.GetFullList() : _pointStorage.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(PointBindingModel model)
+ {
+ CheckModel(model);
+ if (_pointStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(PointBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (model.Amount <= 0)
+ {
+ throw new ArgumentException("Amount must be greater than 0", nameof(model.Amount));
+ }
+ _logger.LogInformation("Component. Amount:{Amount}. Id: { Id}", model.Amount, model.Id);
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/TaskLogic.cs b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/TaskLogic.cs
new file mode 100644
index 0000000..c3196e8
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/TaskLogic.cs
@@ -0,0 +1,108 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopBusinessLogic.BusinessLogic
+{
+ public class TaskLogic : ITaskLogic
+ {
+ private readonly ILogger _logger;
+ private readonly ITaskStorage _taskStorage;
+
+ public TaskLogic(ILogger logger, ITaskStorage taskStorage)
+ {
+ _logger = logger;
+ _taskStorage = taskStorage;
+ }
+
+ public bool Create(TaskBindingModel model)
+ {
+ CheckModel(model);
+ if (_taskStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(TaskBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_taskStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public TaskViewModel? ReadElement(TaskSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
+ var element = _taskStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(TaskSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
+ var list = model == null ? _taskStorage.GetFullList() : _taskStorage.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(TaskBindingModel model)
+ {
+ CheckModel(model);
+ if (_taskStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(TaskBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Description))
+ {
+ throw new ArgumentNullException("Description is required",
+ nameof(model.Description));
+ }
+ _logger.LogInformation("Component. Description:{Description}. Id: { Id}", model.Description, model.Id);
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/WorkLogic.cs b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/WorkLogic.cs
new file mode 100644
index 0000000..5403c8f
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopBusinessLogic/BusinessLogic/WorkLogic.cs
@@ -0,0 +1,108 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopBusinessLogic.BusinessLogic
+{
+ public class WorkLogic : IWorkLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IWorkStorage _workStorage;
+
+ public WorkLogic(ILogger logger, IWorkStorage workStorage)
+ {
+ _logger = logger;
+ _workStorage = workStorage;
+ }
+
+ public bool Create(WorkBindingModel model)
+ {
+ CheckModel(model);
+ if (_workStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(WorkBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_workStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public WorkViewModel? ReadElement(WorkSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
+ var element = _workStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(WorkSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
+ var list = model == null ? _workStorage.GetFullList() : _workStorage.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(WorkBindingModel model)
+ {
+ CheckModel(model);
+ if (_workStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(WorkBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.Type))
+ {
+ throw new ArgumentNullException("Type is required",
+ nameof(model.Type));
+ }
+ _logger.LogInformation("Component. Type:{Type}. Id: { Id}", model.Type, model.Id);
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/AutoRepairShopContracts.csproj b/AutoRepairShop/AutoRepairShopContracts/AutoRepairShopContracts.csproj
new file mode 100644
index 0000000..c948c6a
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/AutoRepairShopContracts.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/AutoRepairShop/AutoRepairShopContracts/BindingModels/ClientBindingModel.cs b/AutoRepairShop/AutoRepairShopContracts/BindingModels/ClientBindingModel.cs
new file mode 100644
index 0000000..66a93fa
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BindingModels/ClientBindingModel.cs
@@ -0,0 +1,16 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BindingModels
+{
+ public class ClientBindingModel : IClientModel
+ {
+ public int Id { get; set; }
+ public string ClientFIO { get; set; } = string.Empty;
+ public string JobTitle { get; set; } = string.Empty;
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BindingModels/ManagerBindingModel.cs b/AutoRepairShop/AutoRepairShopContracts/BindingModels/ManagerBindingModel.cs
new file mode 100644
index 0000000..8bf604f
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BindingModels/ManagerBindingModel.cs
@@ -0,0 +1,19 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BindingModels
+{
+ public class ManagerBindingModel : IManagerModel
+ {
+ public int Id { get; set; }
+ public string ManagerFIO { get; set; } = string.Empty;
+ public string JobTitle { get; set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+ public string Login { get; set; } = string.Empty;
+ public string Password { get; set; } = string.Empty;
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BindingModels/PointBindingModel.cs b/AutoRepairShop/AutoRepairShopContracts/BindingModels/PointBindingModel.cs
new file mode 100644
index 0000000..4e77e84
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BindingModels/PointBindingModel.cs
@@ -0,0 +1,15 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BindingModels
+{
+ public class PointBindingModel : IPointModel
+ {
+ public int Id { get; set; }
+ public int Amount { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BindingModels/TaskBindingModel.cs b/AutoRepairShop/AutoRepairShopContracts/BindingModels/TaskBindingModel.cs
new file mode 100644
index 0000000..8abfbe5
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BindingModels/TaskBindingModel.cs
@@ -0,0 +1,16 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BindingModels
+{
+ public class TaskBindingModel : ITaskModel
+ {
+ public int Id { get; set; }
+ public string Description { get; set; } = string.Empty;
+ public DateTime? DateImplement { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BindingModels/WorkBindingModel.cs b/AutoRepairShop/AutoRepairShopContracts/BindingModels/WorkBindingModel.cs
new file mode 100644
index 0000000..64b8191
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BindingModels/WorkBindingModel.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BindingModels
+{
+ public class WorkBindingModel : IWorkModel
+ {
+ public int Id { get; set; }
+ public int PointId { get; set; }
+ public string Type { get; set; } = string.Empty;
+ public List Points { get; set; }
+ public Dictionary WorkTasks { get; set; } = new();
+ public Dictionary WorkClients { get; set; } = new();
+ public IManagerModel Manager { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IClientLogic.cs b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IClientLogic.cs
new file mode 100644
index 0000000..f642d0f
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IClientLogic.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.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/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IManagerLogic.cs b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IManagerLogic.cs
new file mode 100644
index 0000000..c895360
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IManagerLogic.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BusinessLogicsContracts
+{
+ public interface IManagerLogic
+ {
+ List? ReadList(ManagerSearchModel? model);
+ ManagerViewModel? ReadElement(ManagerSearchModel model);
+ bool Create(ManagerBindingModel model);
+ bool Update(ManagerBindingModel model);
+ bool Delete(ManagerBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IPointLogic.cs b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IPointLogic.cs
new file mode 100644
index 0000000..f3518fd
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IPointLogic.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BusinessLogicsContracts
+{
+ public interface IPointLogic
+ {
+ List? ReadList(PointSearchModel? model);
+ PointViewModel? ReadElement(PointSearchModel model);
+ bool Create(PointBindingModel model);
+ bool Update(PointBindingModel model);
+ bool Delete(PointBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/ITaskLogic.cs b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/ITaskLogic.cs
new file mode 100644
index 0000000..2655134
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/ITaskLogic.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BusinessLogicsContracts
+{
+ public interface ITaskLogic
+ {
+ List? ReadList(TaskSearchModel? model);
+ TaskViewModel? ReadElement(TaskSearchModel model);
+ bool Create(TaskBindingModel model);
+ bool Update(TaskBindingModel model);
+ bool Delete(TaskBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IWorkLogic.cs b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IWorkLogic.cs
new file mode 100644
index 0000000..f16b5ae
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/BusinessLogicsContracts/IWorkLogic.cs
@@ -0,0 +1,20 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.BusinessLogicsContracts
+{
+ public interface IWorkLogic
+ {
+ List? ReadList(WorkSearchModel? model);
+ WorkViewModel? ReadElement(WorkSearchModel model);
+ bool Create(WorkBindingModel model);
+ bool Update(WorkBindingModel model);
+ bool Delete(WorkBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/SearchModels/ClientSearchModel.cs b/AutoRepairShop/AutoRepairShopContracts/SearchModels/ClientSearchModel.cs
new file mode 100644
index 0000000..db2f07c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/SearchModels/ClientSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.SearchModels
+{
+ public class ClientSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ClientFIO { get; set; }
+ public string? JobTitle { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/SearchModels/ManagerSearchModel.cs b/AutoRepairShop/AutoRepairShopContracts/SearchModels/ManagerSearchModel.cs
new file mode 100644
index 0000000..9bc970d
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/SearchModels/ManagerSearchModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.SearchModels
+{
+ public class ManagerSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ManagerFIO { get; set; }
+ public string? Email { get; set; }
+ public string? Login { get; set; }
+ public string? Password { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/SearchModels/PointSearchModel.cs b/AutoRepairShop/AutoRepairShopContracts/SearchModels/PointSearchModel.cs
new file mode 100644
index 0000000..aa87652
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/SearchModels/PointSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.SearchModels
+{
+ public class PointSearchModel
+ {
+ public int? Id { get; set; }
+ public int? Amount { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/SearchModels/TaskSearchModel.cs b/AutoRepairShop/AutoRepairShopContracts/SearchModels/TaskSearchModel.cs
new file mode 100644
index 0000000..2b3e2af
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/SearchModels/TaskSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.SearchModels
+{
+ public class TaskSearchModel
+ {
+ public int? Id { get; set; }
+ public string? Description { get; set; }
+ public DateTime? DateImplement { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/SearchModels/WorkSearchModel.cs b/AutoRepairShop/AutoRepairShopContracts/SearchModels/WorkSearchModel.cs
new file mode 100644
index 0000000..24adf9f
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/SearchModels/WorkSearchModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.SearchModels
+{
+ public class WorkSearchModel
+ {
+ public int? Id { get; set; }
+ public string Type { get; set; }
+ public string Client { get; set; }
+ public string Manager { get; set; }
+ public string Point { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IClientStorage.cs b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IClientStorage.cs
new file mode 100644
index 0000000..923adeb
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IClientStorage.cs
@@ -0,0 +1,21 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.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/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IManagerStorage.cs b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IManagerStorage.cs
new file mode 100644
index 0000000..9c00106
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IManagerStorage.cs
@@ -0,0 +1,21 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.StoragesContracts
+{
+ public interface IManagerStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ManagerSearchModel model);
+ ManagerViewModel? GetElement(ManagerSearchModel model);
+ ManagerViewModel? Insert(ManagerBindingModel model);
+ ManagerViewModel? Update(ManagerBindingModel model);
+ ManagerViewModel? Delete(ManagerBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IPointStorage.cs b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IPointStorage.cs
new file mode 100644
index 0000000..ef866f1
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IPointStorage.cs
@@ -0,0 +1,21 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.StoragesContracts
+{
+ public interface IPointStorage
+ {
+ List GetFullList();
+ List GetFilteredList(PointSearchModel model);
+ PointViewModel? GetElement(PointSearchModel model);
+ PointViewModel? Insert(PointBindingModel model);
+ PointViewModel? Update(PointBindingModel model);
+ PointViewModel? Delete(PointBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/ITaskStorage.cs b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/ITaskStorage.cs
new file mode 100644
index 0000000..ec04e2c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/ITaskStorage.cs
@@ -0,0 +1,21 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.StoragesContracts
+{
+ public interface ITaskStorage
+ {
+ List GetFullList();
+ List GetFilteredList(TaskSearchModel model);
+ TaskViewModel? GetElement(TaskSearchModel model);
+ TaskViewModel? Insert(TaskBindingModel model);
+ TaskViewModel? Update(TaskBindingModel model);
+ TaskViewModel? Delete(TaskBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IWorkStorage.cs b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IWorkStorage.cs
new file mode 100644
index 0000000..751739e
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/StoragesContracts/IWorkStorage.cs
@@ -0,0 +1,21 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.StoragesContracts
+{
+ public interface IWorkStorage
+ {
+ List GetFullList();
+ List GetFilteredList(WorkSearchModel model);
+ WorkViewModel? GetElement(WorkSearchModel model);
+ WorkViewModel? Insert(WorkBindingModel model);
+ WorkViewModel? Update(WorkBindingModel model);
+ WorkViewModel? Delete(WorkBindingModel model);
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/ViewModels/ClientViewModel.cs b/AutoRepairShop/AutoRepairShopContracts/ViewModels/ClientViewModel.cs
new file mode 100644
index 0000000..8b39278
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/ViewModels/ClientViewModel.cs
@@ -0,0 +1,19 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.ViewModels
+{
+ public class ClientViewModel : IClientModel
+ {
+ public int Id { get; set; }
+ [DisplayName("ФИО клиента")]
+ public string ClientFIO { get; set; } = string.Empty;
+ [DisplayName("Должность")]
+ public string JobTitle { get; set; } = string.Empty;
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/ViewModels/ManagerViewModel.cs b/AutoRepairShop/AutoRepairShopContracts/ViewModels/ManagerViewModel.cs
new file mode 100644
index 0000000..f6a10c5
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/ViewModels/ManagerViewModel.cs
@@ -0,0 +1,22 @@
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.ViewModels
+{
+ public class ManagerViewModel : IManagerModel
+ {
+ public int Id { get; set; }
+ [DisplayName("ФИО клиента")]
+ public string ManagerFIO { get; set; } = string.Empty;
+ [DisplayName("Логин (эл. почта)")]
+ public string Email { get; set; } = string.Empty;
+ public string Login { get; set; } = string.Empty;
+ public string Password { get; set; } = string.Empty;
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/ViewModels/PointViewModel.cs b/AutoRepairShop/AutoRepairShopContracts/ViewModels/PointViewModel.cs
new file mode 100644
index 0000000..d1c8682
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/ViewModels/PointViewModel.cs
@@ -0,0 +1,17 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.ViewModels
+{
+ public class PointViewModel : IPointModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Количество")]
+ public int Amount { get; set; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/ViewModels/TaskViewModel.cs b/AutoRepairShop/AutoRepairShopContracts/ViewModels/TaskViewModel.cs
new file mode 100644
index 0000000..fe661d3
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/ViewModels/TaskViewModel.cs
@@ -0,0 +1,24 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.ViewModels
+{
+ public class TaskViewModel : ITaskModel
+ {
+ [DisplayName("Номер")]
+ public int Id { get; set; }
+ [DisplayName("Описание")]
+ public string Description { get; set; }
+
+ [DisplayName("Дата выполнения")]
+ public DateTime? DateImplement { get; set; }
+ public int ClientId { get; set; }
+ [DisplayName("Клиент")]
+ public string ClientFIO { get; set; } = string.Empty;
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopContracts/ViewModels/WorkViewModel.cs b/AutoRepairShop/AutoRepairShopContracts/ViewModels/WorkViewModel.cs
new file mode 100644
index 0000000..5c165ea
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopContracts/ViewModels/WorkViewModel.cs
@@ -0,0 +1,27 @@
+using AutoRepairShopDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopContracts.ViewModels
+{
+ public class WorkViewModel : IWorkModel
+ {
+ [DisplayName("Номер")]
+ public int Id { get; set; }
+ [DisplayName("Тип работы")]
+ public string Type { get; set; }
+ [DisplayName("Баллы")]
+ public Point Point { get; set; }
+ [DisplayName("Руководитель")]
+ public IManagerModel Manager { get; set; }
+ [DisplayName("Задания")]
+ public Dictionary WorkTasks { get; set; } = new();
+ [DisplayName("Клиенты")]
+ public Dictionary WorkClients { get; set; } = new();
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/AutoRepairShopDataModels.csproj b/AutoRepairShop/AutoRepairShopDataModels/AutoRepairShopDataModels.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/AutoRepairShopDataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/AutoRepairShop/AutoRepairShopDataModels/IId.cs b/AutoRepairShop/AutoRepairShopDataModels/IId.cs
new file mode 100644
index 0000000..6465957
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/IId.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels
+{
+ public interface IId
+ {
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/Models/IClientModel.cs b/AutoRepairShop/AutoRepairShopDataModels/Models/IClientModel.cs
new file mode 100644
index 0000000..6223da9
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/Models/IClientModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels.Models
+{
+ public interface IClientModel : IId
+ {
+ string ClientFIO { get; }
+ string JobTitle { get; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/Models/IManagerModel.cs b/AutoRepairShop/AutoRepairShopDataModels/Models/IManagerModel.cs
new file mode 100644
index 0000000..87e12b1
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/Models/IManagerModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels.Models
+{
+ public interface IManagerModel : IId
+ {
+ string ManagerFIO { get; }
+ string Email { get; }
+ string Login { get; }
+ string Password { get; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/Models/IPointModel.cs b/AutoRepairShop/AutoRepairShopDataModels/Models/IPointModel.cs
new file mode 100644
index 0000000..40e6cf4
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/Models/IPointModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels.Models
+{
+ public interface IPointModel : IId
+ {
+ int Amount { get; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/Models/ITaskModel.cs b/AutoRepairShop/AutoRepairShopDataModels/Models/ITaskModel.cs
new file mode 100644
index 0000000..6de9b9c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/Models/ITaskModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels.Models
+{
+ public interface ITaskModel : IId
+ {
+ string Description { get; }
+ DateTime? DateImplement { get; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDataModels/Models/IWorkModel.cs b/AutoRepairShop/AutoRepairShopDataModels/Models/IWorkModel.cs
new file mode 100644
index 0000000..a1c6216
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDataModels/Models/IWorkModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDataModels.Models
+{
+ public interface IWorkModel : IId
+ {
+ int Id { get; }
+ string Type { get; }
+ Dictionary WorkTasks { get; }
+ Dictionary WorkClients { get; }
+ IManagerModel Manager { get; }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabase.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabase.cs
new file mode 100644
index 0000000..797d644
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabase.cs
@@ -0,0 +1,34 @@
+using AutoRepairShopDatabaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+using Npgsql;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Task = AutoRepairShopDatabaseImplement.Models.Task;
+
+namespace AutoRepairShopDatabaseImplement
+{
+ public class AutoRepairShopDatabase : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (optionsBuilder.IsConfigured == false)
+ {
+ optionsBuilder.UseNpgsql("Host=10.211.55.3;Database=AutoRepairShopDatabaseFull;Username=postgres;Password=postgres");
+ }
+
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ public virtual DbSet Points { set; get; }
+ public virtual DbSet Clients { set; get; }
+ public virtual DbSet Managers { set; get; }
+ public virtual DbSet Tasks { set; get; }
+ public virtual DbSet Works { set; get; }
+ public virtual DbSet WorkClients { set; get; }
+ public virtual DbSet WorkTasks { set; get; }
+
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabaseImplement.csproj b/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabaseImplement.csproj
new file mode 100644
index 0000000..86c984c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/AutoRepairShopDatabaseImplement.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ClientStorage.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ClientStorage.cs
new file mode 100644
index 0000000..601556b
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ClientStorage.cs
@@ -0,0 +1,89 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDatabaseImplement.Implements
+{
+ public class ClientStorage : IClientStorage
+ {
+ public ClientViewModel? Delete(ClientBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id);
+ if (element != null)
+ {
+ context.Clients.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+ return null;
+ }
+
+ public ClientViewModel? GetElement(ClientSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.JobTitle) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ using var context = new AutoRepairShopDatabase();
+ return context.Clients.FirstOrDefault(x =>
+ (!string.IsNullOrEmpty(model.JobTitle) && x.JobTitle == model.JobTitle) ||
+ (model.Id.HasValue && x.Id == model.Id))
+ ?.GetViewModel;
+ }
+
+ public List GetFilteredList(ClientSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.JobTitle))
+ {
+ return new();
+ }
+ using var context = new AutoRepairShopDatabase();
+ return context.Clients
+ .Where(x => x.JobTitle.Equals(model.JobTitle))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFullList()
+ {
+ using var context = new AutoRepairShopDatabase();
+ return context.Clients
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public ClientViewModel? Insert(ClientBindingModel model)
+ {
+ var newClient = Client.Create(model);
+ if (newClient == null)
+ {
+ return null;
+ }
+ using var context = new AutoRepairShopDatabase();
+ context.Clients.Add(newClient);
+ context.SaveChanges();
+ return newClient.GetViewModel;
+ }
+
+ public ClientViewModel? Update(ClientBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var client = context.Clients.FirstOrDefault(x => x.Id == model.Id);
+ if (client == null)
+ {
+ return null;
+ }
+ client.Update(model);
+ context.SaveChanges();
+ return client.GetViewModel;
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ManagerStorage.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ManagerStorage.cs
new file mode 100644
index 0000000..54a3915
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/ManagerStorage.cs
@@ -0,0 +1,81 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDatabaseImplement.Implements
+{
+ public class ManagerStorage : IManagerStorage
+ {
+ public ManagerViewModel? Delete(ManagerBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var manager = context.Managers.FirstOrDefault(rec => rec.Id == model.Id);
+ if (manager != null)
+ {
+ context.Managers.Remove(manager);
+ context.SaveChanges();
+ return manager.GetViewModel;
+ }
+ return null;
+ }
+ public ManagerViewModel? GetElement(ManagerSearchModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var manager = context.Managers.FirstOrDefault(x =>
+ x.Email.Equals(model.Email, StringComparison.OrdinalIgnoreCase));
+ return manager != null ? manager.GetViewModel : null;
+ }
+ public List GetFilteredList(ManagerSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Email))
+ {
+ return new List();
+ }
+ using var context = new AutoRepairShopDatabase();
+ var managers = context.Managers
+ .Where(x => x.Email.Equals(model.Email, StringComparison.OrdinalIgnoreCase))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ return managers;
+ }
+ public List GetFullList()
+ {
+ using var context = new AutoRepairShopDatabase();
+ var managers = context.Managers
+ .Select(x => x.GetViewModel)
+ .ToList();
+ return managers;
+ }
+ public ManagerViewModel? Insert(ManagerBindingModel model)
+ {
+ var newManager = Manager.Create(model);
+ if (newManager == null)
+ {
+ return null;
+ }
+ using var context = new AutoRepairShopDatabase();
+ context.Managers.Add(newManager);
+ context.SaveChanges();
+ return newManager.GetViewModel;
+ }
+ public ManagerViewModel? Update(ManagerBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var manager = context.Managers.FirstOrDefault(x => x.Id == model.Id);
+ if (manager == null)
+ {
+ return null;
+ }
+ manager.Update(model);
+ context.SaveChanges();
+ return manager.GetViewModel;
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/PointStorage.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/PointStorage.cs
new file mode 100644
index 0000000..ae2d221
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/PointStorage.cs
@@ -0,0 +1,80 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDatabaseImplement.Implements
+{
+ public class PointStorage : IPointStorage
+ {
+ public PointViewModel? Delete(PointBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var point = context.Points.FirstOrDefault(rec => rec.Id == model.Id);
+ if (point != null)
+ {
+ context.Points.Remove(point);
+ context.SaveChanges();
+ return point.GetViewModel;
+ }
+ return null;
+ }
+
+ public PointViewModel? GetElement(PointSearchModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var point = context.Points.FirstOrDefault(x => x.Id == model.Id);
+ return point != null ? point.GetViewModel : null;
+ }
+
+ public List GetFilteredList(PointSearchModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var points = context.Points
+ .Where(x => x.Amount == model.Amount)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ return points;
+ }
+ public List GetFullList()
+ {
+ using var context = new AutoRepairShopDatabase();
+ var points = context.Points
+ .Select(x => x.GetViewModel)
+ .ToList();
+ return points;
+ }
+ public PointViewModel? Insert(PointBindingModel model)
+ {
+ var newPoint = Point.Create(model);
+ if (newPoint == null)
+ {
+ return null;
+ }
+ using (var context = new AutoRepairShopDatabase())
+ {
+ context.Points.Add(newPoint);
+ context.SaveChanges();
+ }
+ return newPoint.GetViewModel;
+ }
+ public PointViewModel? Update(PointBindingModel model)
+ {
+ using var context = new AutoRepairShopDatabase();
+ var point = context.Points.FirstOrDefault(x => x.Id == model.Id);
+ if (point == null)
+ {
+ return null;
+ }
+ point.Update(model);
+ context.SaveChanges();
+ return point.GetViewModel;
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/TaskStorage.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/TaskStorage.cs
new file mode 100644
index 0000000..2fba95c
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/TaskStorage.cs
@@ -0,0 +1,99 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+
+namespace AutoRepairShopDatabaseImplement.Implements
+{
+ public class TaskStorage : ITaskStorage
+ {
+ public TaskViewModel? Insert(TaskBindingModel model)
+ {
+ var context = new AutoRepairShopDatabase();
+ var newTask = Models.Task.Create(context, model);
+ if (newTask == null)
+ {
+ return null;
+ }
+
+ context.Tasks.Add(newTask);
+ context.SaveChanges();
+ return newTask.GetViewModel;
+ }
+
+ public TaskViewModel? GetElement(TaskSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Description) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Tasks.FirstOrDefault(x =>
+ (!string.IsNullOrEmpty(model.Description) && x.Description == model.Description) ||
+ (model.Id.HasValue && x.Id == model.Id))
+ ?.GetViewModel;
+ }
+ }
+
+ public List GetFilteredList(TaskSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Description))
+ {
+ return new List();
+ }
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Tasks
+ .Where(x => x.Description.Equals(model.Description, StringComparison.OrdinalIgnoreCase))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+
+ public List GetFullList()
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Tasks
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+
+ public TaskViewModel? Update(TaskBindingModel model)
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ var task = context.Tasks.FirstOrDefault(x => x.Id == model.Id);
+ if (task == null)
+ {
+ return null;
+ }
+ task.Update(model);
+ context.SaveChanges();
+ return task.GetViewModel;
+ }
+ }
+
+ public TaskViewModel? Delete(TaskBindingModel model)
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ var task = context.Tasks.FirstOrDefault(x => x.Id == model.Id);
+ if (task != null)
+ {
+ context.Tasks.Remove(task);
+ context.SaveChanges();
+ }
+ return task?.GetViewModel;
+ }
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/WorkStorage.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/WorkStorage.cs
new file mode 100644
index 0000000..8517430
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Implements/WorkStorage.cs
@@ -0,0 +1,103 @@
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.SearchModels;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDatabaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AutoRepairShopDatabaseImplement.Implements
+{
+ public class WorkStorage : IWorkStorage
+ {
+ public WorkViewModel? Insert(WorkBindingModel model)
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ var newWork = Work.Create(context, model);
+ if (newWork == null)
+ {
+ return null;
+ }
+
+ context.Works.Add(newWork);
+ context.SaveChanges();
+
+ return newWork.GetViewModel;
+ }
+
+ }
+
+ public WorkViewModel? GetElement(WorkSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Type) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Works.FirstOrDefault(x =>
+ (!string.IsNullOrEmpty(model.Type) && x.Type == model.Type) ||
+ (model.Id.HasValue && x.Id == model.Id))
+ ?.GetViewModel;
+ }
+ }
+
+ public List GetFilteredList(WorkSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.Type))
+ {
+ return new List();
+ }
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Works
+ .Where(x => x.Type.Equals(model.Type, StringComparison.OrdinalIgnoreCase))
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+
+ public List GetFullList()
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ return context.Works
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+
+ public WorkViewModel? Update(WorkBindingModel model)
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ var work = context.Works.FirstOrDefault(x => x.Id == model.Id);
+ if (work == null)
+ {
+ return null;
+ }
+ work.Update(model);
+ context.SaveChanges();
+ return work.GetViewModel;
+ }
+ }
+
+ public WorkViewModel? Delete(WorkBindingModel model)
+ {
+ using (var context = new AutoRepairShopDatabase())
+ {
+ var work = context.Works.FirstOrDefault(x => x.Id == model.Id);
+ if (work != null)
+ {
+ context.Works.Remove(work);
+ context.SaveChanges();
+ }
+ return work?.GetViewModel;
+ }
+ }
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Client.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Client.cs
new file mode 100644
index 0000000..58dd203
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Client.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class Client : IClientModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public string ClientFIO { get; set; }
+ [Required]
+ public string JobTitle { get; set; }
+ // для реализации связи многие ко многим с изделиями
+ [ForeignKey("ClientId")]
+ public virtual List WorkClients { get; set; } = new();
+ public static Client? Create(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+
+ return new Client()
+ {
+ Id = model.Id,
+ ClientFIO = model.ClientFIO,
+ JobTitle = model.JobTitle
+ };
+ }
+
+ public void Update(ClientBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+
+ ClientFIO = model.ClientFIO;
+ JobTitle = model.JobTitle;
+ }
+
+ public static List GetFilteredList(List clients, Func filter)
+ {
+ return clients.Where(filter).ToList();
+ }
+ public ClientViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ClientFIO = ClientFIO,
+ JobTitle = JobTitle
+ };
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Manager.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Manager.cs
new file mode 100644
index 0000000..fdd7676
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Manager.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class Manager : IManagerModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public string ManagerFIO { get; set; }
+ [Required]
+ public string Email { get; set; }
+ [Required]
+ public string Login { get; set; }
+ [Required]
+ public string Password { get; set; }
+ public static Manager? Create(ManagerBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Manager()
+ {
+ Id = model.Id,
+ ManagerFIO = model.ManagerFIO,
+ Email = model.Email,
+ Login = model.Login,
+ Password = model.Password
+ };
+ }
+ public void Update(ManagerBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ManagerFIO = model.ManagerFIO;
+ Email = model.Email;
+ Login = model.Login;
+ Password = model.Password;
+ }
+ public ManagerViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ManagerFIO = ManagerFIO,
+ Email = Email,
+ Login = Login,
+ Password = Password
+ };
+ }
+}
\ No newline at end of file
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Point.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Point.cs
new file mode 100644
index 0000000..87f1ec5
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Point.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class Point : IPointModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public int Amount { get; set; }
+ public static Point? Create(PointBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Point()
+ {
+ Id = model.Id,
+ Amount = model.Amount
+ };
+ }
+ public void Update(PointBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Amount = model.Amount;
+ }
+ public PointViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Amount = Amount
+ };
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Task.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Task.cs
new file mode 100644
index 0000000..1cf8a79
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Task.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class Task : ITaskModel
+ {
+ public int Id { get; set; }
+ public string Description { get; set; }
+ public DateTime? DateImplement { get; set; }
+
+ [ForeignKey("TaskId")]
+ public virtual List WorkTasks { get; set; } = new();
+ public static Task Create(AutoRepairShopDatabase context, TaskBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+
+ var newTask = new Task
+ {
+ Id = model.Id,
+ Description = model.Description,
+ DateImplement = model.DateImplement
+ };
+
+ return newTask;
+ }
+ public void Update(TaskBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+
+ Description = model.Description;
+ DateImplement = model.DateImplement;
+ }
+
+ public static List GetFilteredList(List tasks, Func filter)
+ {
+ return tasks.Where(filter).ToList();
+ }
+
+ public TaskViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Description = Description,
+ DateImplement = DateImplement
+ };
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Work.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Work.cs
new file mode 100644
index 0000000..f8b3d44
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/Work.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopContracts.BindingModels;
+using AutoRepairShopContracts.ViewModels;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class Work : IWorkModel
+ {
+ public int Id { get; set; }
+
+ [Required]
+ public string Type { get; set; }
+
+ private Dictionary _workTasks = new();
+
+ [NotMapped]
+ public Dictionary WorkTasks
+ {
+ get
+ {
+ if (_workTasks == null)
+ {
+ _workTasks = Tasks.ToDictionary(recPC => recPC.TaskId, recPC => (recPC.Task as ITaskModel, recPC.Count));
+ }
+
+ return _workTasks;
+ }
+ }
+
+ private Dictionary _workClients = new();
+
+ [NotMapped]
+ public Dictionary WorkClients
+ {
+ get
+ {
+ if (_workClients == null)
+ {
+ _workClients = Clients.ToDictionary(recPC => recPC.ClientId, recPC => (recPC.Client as IClientModel, recPC.Count));
+ }
+
+ return _workClients;
+ }
+ }
+
+ [ForeignKey("WorkId")]
+ public virtual List Tasks { get; set; } = new();
+
+ [ForeignKey("WorkId")]
+ public virtual List Clients { get; set; } = new();
+
+ [ForeignKey("PointId")]
+ public int PointId { get; set; }
+
+ public virtual Point Point { get; set; }
+
+ public IManagerModel Manager { get; set; }
+
+ public static Work Create(AutoRepairShopDatabase context, WorkBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+
+ return new Work()
+ {
+ Id = model.Id,
+ Type = model.Type,
+ Tasks = model.WorkTasks.Select(x => new WorkTasks
+ {
+ Task = context.Tasks.First(y => y.Id == x.Key),
+ Count = x.Value.Item2
+ }).ToList(),
+ Clients = model.WorkClients.Select(x => new WorkClients
+ {
+ Client = context.Clients.First(y => y.Id == x.Key),
+ Count = x.Value.Item2
+ }).ToList(),
+ PointId = model.PointId,
+ Point = context.Points.First(p => p.Id == model.PointId),
+ Manager = model.Manager
+ };
+ }
+
+ public void Update(WorkBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+
+ Type = model.Type;
+ PointId = model.PointId;
+ Manager = model.Manager;
+ }
+
+ public WorkViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Type = Type,
+ Manager = Manager
+ };
+ }
+}
\ No newline at end of file
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkClients.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkClients.cs
new file mode 100644
index 0000000..4fd8554
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkClients.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class WorkClients
+ {
+ public int Id { get; set; }
+ [Required]
+ public int ClientId { get; set; }
+ [Required]
+ public int Count { get; set; }
+ public virtual Client Client { get; set; } = new();
+ public virtual Work Work { get; set; } = new();
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkTasks.cs b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkTasks.cs
new file mode 100644
index 0000000..1258ff2
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopDatabaseImplement/Models/WorkTasks.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoRepairShopDataModels.Models;
+
+namespace AutoRepairShopDatabaseImplement.Models
+{
+ public class WorkTasks
+ {
+ public int Id { get; set; }
+ [Required]
+ public int TaskId { get; set; }
+ [Required]
+ public int Count { get; set; }
+ public virtual Task Task { get; set; } = new();
+ public virtual Work Work { get; set; } = new();
+ }
+}
diff --git a/AutoRepairShop/AutoRepairShopView/AutoRepairShopView.csproj b/AutoRepairShop/AutoRepairShopView/AutoRepairShopView.csproj
new file mode 100644
index 0000000..f5cf992
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopView/AutoRepairShopView.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AutoRepairShop/AutoRepairShopView/Program.cs b/AutoRepairShop/AutoRepairShopView/Program.cs
new file mode 100644
index 0000000..faeadd9
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopView/Program.cs
@@ -0,0 +1,53 @@
+using AutoRepairShopBusinessLogic;
+using AutoRepairShopBusinessLogic.BusinessLogic;
+using AutoRepairShopContracts.BusinessLogicsContracts;
+using AutoRepairShopContracts.StoragesContracts;
+using AutoRepairShopDatabaseImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NLog.Extensions.Logging;
+using System;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace FurnitureAssembly
+{
+ internal static class Program
+ {
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ // ApplicationConfiguration.Initialize();
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ // Application.Run(_serviceProvider.GetRequiredService());
+
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ }
+ }
+}
\ No newline at end of file
diff --git a/AutoRepairShop/AutoRepairShopView/nlog.config b/AutoRepairShop/AutoRepairShopView/nlog.config
new file mode 100644
index 0000000..90c7601
--- /dev/null
+++ b/AutoRepairShop/AutoRepairShopView/nlog.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file