+бизнес логика

This commit is contained in:
maxnes3 2023-04-07 03:03:14 +04:00
parent 2fe6b9346e
commit 0d95ebcaa0
10 changed files with 857 additions and 2 deletions

View File

@ -5,9 +5,11 @@ VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseAccountingDataModels", "CaseAccountingDataModels\CaseAccountingDataModels.csproj", "{CAA81DB0-6CCA-4CBE-ABE2-94CDB190E05F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseAccountingDataModels", "CaseAccountingDataModels\CaseAccountingDataModels.csproj", "{CAA81DB0-6CCA-4CBE-ABE2-94CDB190E05F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaseAccountingContracts", "CaseAccountingContracts\CaseAccountingContracts.csproj", "{5014C0D9-62EF-41AD-A8A1-22E89C43E062}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseAccountingContracts", "CaseAccountingContracts\CaseAccountingContracts.csproj", "{5014C0D9-62EF-41AD-A8A1-22E89C43E062}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaseAccountingDataBaseImplement", "CaseAccountingDataBaseImplement\CaseAccountingDataBaseImplement.csproj", "{09C614AF-5BF5-4969-9609-D6A23DD74AA8}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseAccountingDataBaseImplement", "CaseAccountingDataBaseImplement\CaseAccountingDataBaseImplement.csproj", "{09C614AF-5BF5-4969-9609-D6A23DD74AA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaseAccountingBusinessLogic", "CaseAccountingBusinessLogics\CaseAccountingBusinessLogic.csproj", "{4D95FDCC-80B3-452F-86FD-D514655ED0FB}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -27,6 +29,10 @@ Global
{09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Debug|Any CPU.Build.0 = Debug|Any CPU {09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Release|Any CPU.ActiveCfg = Release|Any CPU {09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Release|Any CPU.Build.0 = Release|Any CPU {09C614AF-5BF5-4969-9609-D6A23DD74AA8}.Release|Any CPU.Build.0 = Release|Any CPU
{4D95FDCC-80B3-452F-86FD-D514655ED0FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D95FDCC-80B3-452F-86FD-D514655ED0FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D95FDCC-80B3-452F-86FD-D514655ED0FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D95FDCC-80B3-452F-86FD-D514655ED0FB}.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,122 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class CaseLogic : ICaseLogic
{
private readonly ILogger _logger;
private readonly ICaseStorage _caseStorage;
public CaseLogic(ILogger<CaseLogic> logger, ICaseStorage caseStorage)
{
_logger = logger;
_caseStorage = caseStorage;
}
public bool Create(CaseBindingModel model)
{
CheckModel(model);
if (_caseStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(CaseBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_caseStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public CaseViewModel? ReadElement(CaseSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. CaseName:{Name}.Id:{ Id}", model.Name, model.Id);
var element = _caseStorage.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<CaseViewModel>? ReadList(CaseSearchModel? model)
{
_logger.LogInformation("ReadList. CaseName:{Name}.Id:{ Id}", model?.Name, model?.Id);
var list = model == null ? _caseStorage.GetFullList() : _caseStorage.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(CaseBindingModel model)
{
CheckModel(model);
if (_caseStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(CaseBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.SpecializationId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор специализации",
nameof(model.SpecializationId));
}
if (model.Name == string.Empty)
{
throw new ArgumentNullException("Некорректное название дела",
nameof(model.Name));
}
if(model.Date > DateTime.Now)
{
throw new ArgumentNullException("Некорректное время заведения дела",
nameof(model.Date));
}
}
}
}

View File

@ -0,0 +1,117 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class ContractLogic : IContractLogic
{
private readonly ILogger _logger;
private readonly IContractStorage _contractStorage;
public ContractLogic(ILogger<ContractLogic> logger, IContractStorage contractStorage)
{
_logger = logger;
_contractStorage = contractStorage;
}
public bool Create(ContractBindingModel model)
{
CheckModel(model);
if (_contractStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(ContractBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_contractStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public ContractViewModel? ReadElement(ContractSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _contractStorage.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<ContractViewModel>? ReadList(ContractSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _contractStorage.GetFullList() : _contractStorage.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(ContractBindingModel model)
{
CheckModel(model);
if (_contractStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(ContractBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.Coast <= 0)
{
throw new ArgumentNullException("Некорректная стоимость услуги",
nameof(model.Coast));
}
if (model.Service == string.Empty)
{
throw new ArgumentNullException("Некорректное название услуги",
nameof(model.Service));
}
}
}
}

View File

@ -0,0 +1,117 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class DealLogic : IDealLogic
{
private readonly ILogger _logger;
private readonly IDealStorage _dealStorage;
public DealLogic(ILogger<DealLogic> logger, IDealStorage dealStorage)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_dealStorage = dealStorage ?? throw new ArgumentNullException(nameof(dealStorage));
}
public bool Create(DealBindingModel model)
{
CheckModel(model);
if (_dealStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(DealBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_dealStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public DealViewModel? ReadElement(DealSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _dealStorage.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<DealViewModel>? ReadList(DealSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _dealStorage.GetFullList() : _dealStorage.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(DealBindingModel model)
{
CheckModel(model);
if (_dealStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(DealBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.Subject == string.Empty)
{
throw new ArgumentNullException("Некорректный предмет договора",
nameof(model.Subject));
}
if (model.Responsibilities == string.Empty)
{
throw new ArgumentNullException("Некорректно указаны обязанности договора",
nameof(model.Responsibilities));
}
}
}
}

View File

@ -0,0 +1,117 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class HearingLogic : IHearingLogic
{
private readonly ILogger _logger;
private readonly IHearingStorage _hearingStorage;
public HearingLogic(ILogger<HearingLogic> logger, IHearingStorage hearingStorage)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_hearingStorage = hearingStorage ?? throw new ArgumentNullException(nameof(hearingStorage));
}
public bool Create(HearingBindingModel model)
{
CheckModel(model);
if (_hearingStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(HearingBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_hearingStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public HearingViewModel? ReadElement(HearingSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _hearingStorage.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<HearingViewModel>? ReadList(HearingSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _hearingStorage.GetFullList() : _hearingStorage.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(HearingBindingModel model)
{
CheckModel(model);
if (_hearingStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(HearingBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.CaseId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор дела",
nameof(model.CaseId));
}
if (model.Information == string.Empty)
{
throw new ArgumentNullException("Некорректна написана информация по делу",
nameof(model.Information));
}
}
}
}

View File

@ -0,0 +1,127 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class LawyerLogic : ILawyerLogic
{
private readonly ILogger _logger;
private readonly ILawyerStorage _lawyerStorage;
public LawyerLogic(ILogger<LawyerLogic> logger, ILawyerStorage lawyerStorage)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_lawyerStorage = lawyerStorage ?? throw new ArgumentNullException(nameof(lawyerStorage));
}
public bool Create(LawyerBindingModel model)
{
CheckModel(model);
if (_lawyerStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(LawyerBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_lawyerStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public LawyerViewModel? ReadElement(LawyerSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _lawyerStorage.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<LawyerViewModel>? ReadList(LawyerSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _lawyerStorage.GetFullList() : _lawyerStorage.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(LawyerBindingModel model)
{
CheckModel(model);
if (_lawyerStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(LawyerBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.SpecializationId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор специализации",
nameof(model.SpecializationId));
}
if (model.Experience < 0)
{
throw new ArgumentNullException("Некорректно указан опыт работы",
nameof(model.Experience));
}
if (model.Name == string.Empty)
{
throw new ArgumentNullException("Некорректное имя юриста",
nameof(model.Name));
}
if (model.Surname == string.Empty)
{
throw new ArgumentNullException("Некорректная фамилия юриста",
nameof(model.Surname));
}
}
}
}

View File

@ -0,0 +1,112 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class SpecializationLogic : ISpecializationLogic
{
private readonly ILogger _logger;
private readonly ISpecializationStorage _specializationStorage;
public SpecializationLogic(ILogger<SpecializationLogic> logger, ISpecializationStorage specializationStorage)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_specializationStorage = specializationStorage ?? throw new ArgumentNullException(nameof(specializationStorage));
}
public bool Create(SpecializationBindingModel model)
{
CheckModel(model);
if (_specializationStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(SpecializationBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_specializationStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public SpecializationViewModel? ReadElement(SpecializationSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _specializationStorage.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<SpecializationViewModel>? ReadList(SpecializationSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _specializationStorage.GetFullList() : _specializationStorage.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(SpecializationBindingModel model)
{
CheckModel(model);
if (_specializationStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(SpecializationBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.UserId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор пользователя",
nameof(model.UserId));
}
if (model.Name == string.Empty)
{
throw new ArgumentNullException("Некорректное название специализации",
nameof(model.Name));
}
}
}
}

View File

@ -0,0 +1,117 @@
using CaseAccountingContracts.BindingModels;
using CaseAccountingContracts.BusinessLogicContracts;
using CaseAccountingContracts.SearchModels;
using CaseAccountingContracts.StoragesContracts;
using CaseAccountingContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CaseAccountingBusinessLogic.BusinessLogics
{
public class UserLogic : IUserLogic
{
private readonly ILogger _logger;
private readonly IUserStorage _userStorage;
public UserLogic(ILogger logger, IUserStorage userStorage)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_userStorage = userStorage ?? throw new ArgumentNullException(nameof(userStorage));
}
public bool Create(UserBindingModel model)
{
CheckModel(model);
if (_userStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(UserBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_userStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public UserViewModel? ReadElement(UserSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{ Id}", model.Id);
var element = _userStorage.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<UserViewModel>? ReadList(UserSearchModel? model)
{
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
var list = model == null ? _userStorage.GetFullList() : _userStorage.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(UserBindingModel model)
{
CheckModel(model);
if (_userStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(UserBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (model.RoleId < 0)
{
throw new ArgumentNullException("Некорректный идентификатор роли",
nameof(model.RoleId));
}
if (model.Login == string.Empty)
{
throw new ArgumentNullException("Некорректный ввод логина",
nameof(model.Login));
}
if (model.Password == string.Empty)
{
throw new ArgumentNullException("Некорректный ввод пароля",
nameof(model.Password));
}
}
}
}

View File

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

View File

@ -17,5 +17,7 @@ namespace CaseAccountingContracts.SearchModels
public string? Defendant { get; set; } public string? Defendant { get; set; }
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
public int? UserId { get; set; }
} }
} }