Этап 4. Бизнес-логика без отчетов

This commit is contained in:
prodigygirl 2023-04-06 13:34:53 +04:00
parent 96a411f449
commit d9c9cf410a
10 changed files with 807 additions and 1 deletions

View File

@ -9,7 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDataModels", "Hospi
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{F24FE3B9-EA65-4793-A950-68857BCC7DB2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{F24FE3B9-EA65-4793-A950-68857BCC7DB2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalDatabaseImplement", "HospitalDatabaseImplement\HospitalDatabaseImplement.csproj", "{B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDatabaseImplement", "HospitalDatabaseImplement\HospitalDatabaseImplement.csproj", "{B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalBusinessLogic", "HospitalBusinessLogic\HospitalBusinessLogic.csproj", "{C8819EE4-365C-4960-9578-3B8A45B5EBF4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{A8EB3C34-5C9B-4C40-8B0F-21D62ACBFFFF}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,6 +37,14 @@ Global
{B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Debug|Any CPU.Build.0 = Debug|Any CPU {B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Release|Any CPU.ActiveCfg = Release|Any CPU {B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Release|Any CPU.Build.0 = Release|Any CPU {B99AB6C1-2F4F-4E40-B933-45CE5E6CC37B}.Release|Any CPU.Build.0 = Release|Any CPU
{C8819EE4-365C-4960-9578-3B8A45B5EBF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8819EE4-365C-4960-9578-3B8A45B5EBF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8819EE4-365C-4960-9578-3B8A45B5EBF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8819EE4-365C-4960-9578-3B8A45B5EBF4}.Release|Any CPU.Build.0 = Release|Any CPU
{A8EB3C34-5C9B-4C40-8B0F-21D62ACBFFFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8EB3C34-5C9B-4C40-8B0F-21D62ACBFFFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8EB3C34-5C9B-4C40-8B0F-21D62ACBFFFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8EB3C34-5C9B-4C40-8B0F-21D62ACBFFFF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,119 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace HospitalBusinessLogic
{
public class ApothecaryLogic : IApothecaryLogic
{
private readonly ILogger _logger;
private readonly IApothecaryStorage _apothecaryStorage;
public ApothecaryLogic(ILogger<ApothecaryLogic> logger, IApothecaryStorage apothecaryStorage)
{
_logger = logger;
_apothecaryStorage = apothecaryStorage;
}
public ApothecaryViewModel? ReadElement(ApothecarySearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Login: {Login} Id:{ Id}", model.Login, model.Id);
var element = _apothecaryStorage.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<ApothecaryViewModel>? ReadList(ApothecarySearchModel? model)
{
_logger.LogInformation("ReadList. Login: {Login}. Id:{ Id}", model?.Login, model?.Id);
var list = model == null ? _apothecaryStorage.GetFullList() : _apothecaryStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(ApothecaryBindingModel model)
{
CheckModel(model);
if (_apothecaryStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(ApothecaryBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_apothecaryStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(ApothecaryBindingModel model)
{
CheckModel(model);
if (_apothecaryStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(ApothecaryBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Login))
{
throw new ArgumentNullException("Нет логина пользователя",
nameof(model.Login));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля пользователя",
nameof(model.Password));
}
if (model.Password.Length < 5 || model.Password.Length > 15)
{
throw new ArgumentNullException("Пароль должен иметь длину от 5 до 15 символов",
nameof(model.Password));
}
_logger.LogInformation("Apothecary. Login:{ Login}. Id: { Id}", model.Login, model.Id);
var element = _apothecaryStorage.GetElement(new ApothecarySearchModel { Login = model.Login });
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Пользователь с таким логином уже есть");
}
}
}
}

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HospitalContracts\HospitalContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,113 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace HospitalBusinessLogic
{
public class MedicineLogic : IMedicineLogic
{
private readonly ILogger _logger;
private readonly IMedicineStorage _medicineStorage;
public MedicineLogic(ILogger<MedicineLogic> logger, IMedicineStorage medicineStorage)
{
_logger = logger;
_medicineStorage = medicineStorage;
}
public MedicineViewModel? ReadElement(MedicineSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Name: {Name}. Id:{ Id}", model.Name, model.Id);
var element = _medicineStorage.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<MedicineViewModel>? ReadList(MedicineSearchModel? model)
{
_logger.LogInformation("ReadList. Name: {Name}. Id:{ Id}", model?.Name, model?.Id);
var list = model == null ? _medicineStorage.GetFullList() : _medicineStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(MedicineBindingModel model)
{
CheckModel(model);
if (_medicineStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(MedicineBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_medicineStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(MedicineBindingModel model)
{
CheckModel(model);
if (_medicineStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(MedicineBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия лекарства",
nameof(model.Name));
}
if (model.Cost <= 0)
{
throw new ArgumentNullException("Стоимость лекарства должна быть больше 0",
nameof(model.Cost));
}
if (string.IsNullOrEmpty(model.Dose))
{
throw new ArgumentNullException("Нет дозировки лекарства",
nameof(model.Dose));
}
_logger.LogInformation("Medicine. Name:{ Name}. Cost: {Cost}. Dose: {Dose}. Id: { Id}", model.Name, model.Cost, model.Dose, model.Id);
}
}
}

View File

@ -0,0 +1,111 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalBusinessLogic
{
public class PatientLogic : IPatientLogic
{
private readonly ILogger _logger;
private readonly IPatientStorage _patientStorage;
public PatientLogic(ILogger<PatientLogic> logger, IPatientStorage patientStorage)
{
_logger = logger;
_patientStorage = patientStorage;
}
public PatientViewModel? ReadElement(PatientSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _patientStorage.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<PatientViewModel>? ReadList(PatientSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _patientStorage.GetFullList() : _patientStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(PatientBindingModel model)
{
CheckModel(model);
if (_patientStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(PatientBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_patientStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(PatientBindingModel model)
{
CheckModel(model);
if (_patientStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(PatientBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет имени пациента",
nameof(model.Name));
}
// TODO: проверка на наличие даты рождения и фамилии в модели?
_logger.LogInformation("Patient. Surname:{ Date}. Name: {Name}. Patronymic: {Patronymic}. BirthDate: {BirthDate}. Id: { Id}", model.Surname, model.Name, model.Patronymic, model.BirthDate, model.Id);
}
}
}

View File

@ -0,0 +1,103 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace HospitalBusinessLogic
{
public class PrescriptionLogic : IPrescriptionLogic
{
private readonly ILogger _logger;
private readonly IPrescriptionStorage _prescriptionStorage;
public PrescriptionLogic(ILogger<PrescriptionLogic> logger, IPrescriptionStorage prescriptionStorage)
{
_logger = logger;
_prescriptionStorage = prescriptionStorage;
}
public PrescriptionViewModel? ReadElement(PrescriptionSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _prescriptionStorage.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<PrescriptionViewModel>? ReadList(PrescriptionSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _prescriptionStorage.GetFullList() : _prescriptionStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(PrescriptionBindingModel model)
{
CheckModel(model);
if (_prescriptionStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(PrescriptionBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_prescriptionStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(PrescriptionBindingModel model)
{
CheckModel(model);
if (_prescriptionStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(PrescriptionBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.Number <= 0)
{
throw new ArgumentNullException("Количество лекарств в поставке должно быть больше 0", nameof(model.Number));
}
_logger.LogInformation("Prescription. Date:{ Date}. Number: {Number}. MedicineId: {MedicineId}. Id: { Id}", model.Date, model.Number, model.MedicineId, model.Id);
}
}
}

View File

@ -0,0 +1,108 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalBusinessLogic
{
public class ProcedureLogic : IProcedureLogic
{
private readonly ILogger _logger;
private readonly IProcedureStorage _procedureStorage;
public ProcedureLogic(ILogger<ProcedureLogic> logger, IProcedureStorage procedureStorage)
{
_logger = logger;
_procedureStorage = procedureStorage;
}
public ProcedureViewModel? ReadElement(ProcedureSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _procedureStorage.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<ProcedureViewModel>? ReadList(ProcedureSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _procedureStorage.GetFullList() : _procedureStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(ProcedureBindingModel model)
{
CheckModel(model);
if (_procedureStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(ProcedureBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_procedureStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(ProcedureBindingModel model)
{
CheckModel(model);
if (_procedureStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(ProcedureBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия процедуры",
nameof(model.Name));
}
_logger.LogInformation("Procedure. Name: {Name}.Id: { Id}", model.Name, model.Id);
}
}
}

View File

@ -0,0 +1,103 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace HospitalBusinessLogic
{
public class RecipeLogic : IRecipeLogic
{
private readonly ILogger _logger;
private readonly IRecipeStorage _recipeStorage;
public RecipeLogic(ILogger<RecipeLogic> logger, IRecipeStorage recipeStorage)
{
_logger = logger;
_recipeStorage = recipeStorage;
}
public RecipeViewModel? ReadElement(RecipeSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _recipeStorage.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<RecipeViewModel>? ReadList(RecipeSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _recipeStorage.GetFullList() : _recipeStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(RecipeBindingModel model)
{
CheckModel(model);
if (_recipeStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(RecipeBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_recipeStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(RecipeBindingModel model)
{
CheckModel(model);
if (_recipeStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(RecipeBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия рецепта",
nameof(model.Name));
}
_logger.LogInformation("Recipe. Date:{ Date}. Name: {Name}. Id: { Id}", model.Date, model.Name, model.Id);
}
}
}

View File

@ -0,0 +1,104 @@
using HospitalContracts.BindingModels;
using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.StorageContracts;
using HospitalContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace HospitalBusinessLogic
{
public class TreatmentLogic : ITreatmentLogic
{
private readonly ILogger _logger;
private readonly ITreatmentStorage _treatmentStorage;
public TreatmentLogic(ILogger<TreatmentLogic> logger, ITreatmentStorage treatmentStorage)
{
_logger = logger;
_treatmentStorage = treatmentStorage;
}
public TreatmentViewModel? ReadElement(TreatmentSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _treatmentStorage.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<TreatmentViewModel>? ReadList(TreatmentSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _treatmentStorage.GetFullList() : _treatmentStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Create(TreatmentBindingModel model)
{
CheckModel(model);
if (_treatmentStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(TreatmentBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_treatmentStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public bool Update(TreatmentBindingModel model)
{
CheckModel(model);
if (_treatmentStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(TreatmentBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия лечения",
nameof(model.Name));
}
_logger.LogInformation("Treatment. Name: {Name}.Id: { Id}", model.Name, model.Id);
}
}
}

View File

@ -6,4 +6,17 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HospitalBusinessLogic\HospitalBusinessLogic.csproj" />
<ProjectReference Include="..\HospitalContracts\HospitalContracts.csproj" />
<ProjectReference Include="..\HospitalDatabaseImplement\HospitalDatabaseImplement.csproj" />
</ItemGroup>
</Project> </Project>