Compare commits
2 Commits
03a7c2a36b
...
54d23f7166
Author | SHA1 | Date | |
---|---|---|---|
54d23f7166 | |||
5fd73203cf |
162
CarCenter/CarCenterBusinessLogic/BusinessLogics/EmployeeLogic.cs
Normal file
162
CarCenter/CarCenterBusinessLogic/BusinessLogics/EmployeeLogic.cs
Normal file
@ -0,0 +1,162 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using CarCenterDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.IO.Packaging;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class EmployeeLogic : IEmployeeLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IEmployeeStorage _employeeStorage;
|
||||
private readonly IManagerLogic _managerLogic;
|
||||
|
||||
public EmployeeLogic(ILogger<EmployeeLogic> logger, IEmployeeStorage EmployeeStorage, IManagerLogic ManagerLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_employeeStorage = EmployeeStorage;
|
||||
_managerLogic = ManagerLogic;
|
||||
}
|
||||
public bool Create(EmployeeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
model.EmployeeSale = new();
|
||||
|
||||
var result = _employeeStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(EmployeeBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
var result = _employeeStorage.Delete(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public EmployeeViewModel? ReadElement(EmployeeSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. EmployeeFIO:{EmployeeFIO}.Id:{Id}", model.EmployeeFIO, model.Id);
|
||||
|
||||
var element = _employeeStorage.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<EmployeeViewModel>? ReadList(EmployeeSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. EmployeeFIO:{EmployeeFIO}.Id:{ Id}", model?.EmployeeFIO, model?.Id);
|
||||
|
||||
var list = model == null ? _employeeStorage.GetFullList() : _employeeStorage.GetFilteredList(model);
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool AddSaleToEmployee(EmployeeSearchModel model, ISaleModel Sale)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddSaleToEmployee. EmployeeFIO:{EmployeeFIO}.Id:{ Id}", model.EmployeeFIO, model.Id);
|
||||
var element = _employeeStorage.GetElement(model);
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("AddSaleToEmployee element not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddSaleToEmployee find. Id:{Id}", element.Id);
|
||||
|
||||
element.EmployeeSale[Sale.Id] = Sale;
|
||||
|
||||
_employeeStorage.Update(new()
|
||||
{
|
||||
Id = element.Id,
|
||||
EmployeeFIO = element.EmployeeFIO,
|
||||
Specialization = element.Specialization,
|
||||
ManagerId = element.ManagerId,
|
||||
EmployeeSale = element.EmployeeSale,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool Update(EmployeeBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_employeeStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(EmployeeBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.EmployeeFIO))
|
||||
{
|
||||
throw new ArgumentNullException("Нет ФИО сотрудника", nameof(model.EmployeeFIO));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Employee. EmployeeFIO:{EmployeeFIO}.StartDate:{ StartDate}. Id: { Id}", model.EmployeeFIO, model.Specialization, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
173
CarCenter/CarCenterBusinessLogic/BusinessLogics/ManagerLogic.cs
Normal file
173
CarCenter/CarCenterBusinessLogic/BusinessLogics/ManagerLogic.cs
Normal file
@ -0,0 +1,173 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ManagerLogic : IManagerLogic
|
||||
{
|
||||
private readonly int _loginMaxLength = 50;
|
||||
private readonly int _passwordMaxLength = 50;
|
||||
private readonly int _passwordMinLength = 10;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IManagerStorage _managerStorage;
|
||||
|
||||
public ManagerLogic(ILogger<ManagerLogic> 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. ManagerFIO: {ManagerFIO}. ManagerLogin: {ManagerLogin}. Id: {Id}.", model.ManagerFIO, model.ManagerLogin, 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<ManagerViewModel>? ReadList(ManagerSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ManagerFIO: {ManagerFIO}. ManagerLogin: {ManagerLogin}. Id: {Id}.", model?.ManagerFIO, model?.ManagerLogin, 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.ManagerLogin))
|
||||
{
|
||||
throw new ArgumentNullException("Нет логина менеджера", nameof(model.ManagerLogin));
|
||||
}
|
||||
|
||||
if (model.ManagerLogin.Length>_loginMaxLength)
|
||||
{
|
||||
throw new ArgumentNullException("Логин слишком длинный", nameof(model.ManagerLogin));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.ManagerNumber))
|
||||
{
|
||||
throw new ArgumentNullException("Нет номера телефона менеджера", nameof(model.ManagerNumber));
|
||||
}
|
||||
|
||||
if (model.ManagerEmail.Length > _loginMaxLength || !Regex.IsMatch(model.ManagerEmail, @"([a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+)"))
|
||||
{
|
||||
throw new Exception($"В качестве логина должна быть указана почта и иметь длинну не более {_loginMaxLength} символов");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.ManagerEmail))
|
||||
{
|
||||
throw new ArgumentNullException("Нет почты менеджера", nameof(model.ManagerEmail));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.ManagerPassword))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля менеджера", nameof(model.ManagerPassword));
|
||||
}
|
||||
|
||||
if (model.ManagerPassword.Length > _passwordMaxLength || model.ManagerPassword.Length < _passwordMinLength
|
||||
|| !Regex.IsMatch(model.ManagerPassword, @"^((\w+\d+\W+)|(\w+\W+\d+)|(\d+\w+\W+)|(\d+\W+\w+)|(\W+\w+\d+)|(\W+\d+\w+))[\w\d\W]*$"))
|
||||
{
|
||||
throw new Exception($"Пароль длиной от {_passwordMinLength} до {_passwordMaxLength} должен состоять из цифр, букв и небуквенных символов");
|
||||
}
|
||||
|
||||
_logger.LogInformation("Manager. ManagerFIO: {ManagerFIO}. ManagerLogin: {ManagerLogin}. Id: {Id}", model.ManagerFIO, model.ManagerLogin, model.Id);
|
||||
|
||||
var element = _managerStorage.GetElement(new ManagerSearchModel
|
||||
{
|
||||
ManagerEmail = model.ManagerEmail
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("менеджер с таким логином уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using CarCenterDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class PreSaleWorkLogic : IPreSaleWorkLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPreSaleWorkStorage _PreSaleWorkStorage;
|
||||
private readonly IManagerLogic _managerLogic;
|
||||
|
||||
public PreSaleWorkLogic(ILogger<PreSaleWorkLogic> logger, IPreSaleWorkStorage PreSaleWorkStorage, IManagerLogic ManagerLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_PreSaleWorkStorage = PreSaleWorkStorage;
|
||||
_managerLogic = ManagerLogic;
|
||||
}
|
||||
|
||||
public bool AddSaleToPreSaleWork(PreSaleWorkSearchModel model, ISaleModel Sale)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddSaleToPreSaleWork. PreSaleWorkType:{PreSaleWorkType}.Id:{ Id}", model.PreSaleWorkType, model.Id);
|
||||
var element = _PreSaleWorkStorage.GetElement(model);
|
||||
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("AddSaleToPreSaleWork element not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("AddSaleToPreSaleWork find. Id:{Id}", element.Id);
|
||||
|
||||
element.PreSaleWorkSale[Sale.Id] = Sale;
|
||||
|
||||
_PreSaleWorkStorage.Update(new()
|
||||
{
|
||||
Id = element.Id,
|
||||
PreSaleWorkType = element.PreSaleWorkType,
|
||||
PreSaleWorkPrice = element.PreSaleWorkPrice,
|
||||
ManagerId = element.ManagerId,
|
||||
PreSaleWorkSale = element.PreSaleWorkSale
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Create(PreSaleWorkBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
model.PreSaleWorkSale = new();
|
||||
|
||||
var result = _PreSaleWorkStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(PreSaleWorkBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
var result = _PreSaleWorkStorage.Delete(model);
|
||||
|
||||
if (result== null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public PreSaleWorkModel? ReadElement(PreSaleWorkSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. PreSaleWorkType:{PreSaleWorkType}.Id:{Id}", model.PreSaleWorkType, model.Id);
|
||||
|
||||
var element = _PreSaleWorkStorage.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<PreSaleWorkModel>? ReadList(PreSaleWorkSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. PreSaleWorkType:{PreSaleWorkType}.Id:{ Id}", model?.PreSaleWorkType, model?.Id);
|
||||
|
||||
var list = model == null ? _PreSaleWorkStorage.GetFullList() : _PreSaleWorkStorage.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(PreSaleWorkBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_PreSaleWorkStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(PreSaleWorkBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.PreSaleWorkType))
|
||||
{
|
||||
throw new ArgumentNullException("Нет такого типа предпродажной работы", nameof(model.PreSaleWorkType));
|
||||
}
|
||||
|
||||
if (model.PreSaleWorkPrice<0)
|
||||
{
|
||||
throw new ArgumentNullException("Стоимость предпродажной работы не может быть меньше 0", nameof(model.PreSaleWorkPrice));
|
||||
}
|
||||
|
||||
_logger.LogInformation("PreSaleWork. PreSaleWorkType:{PreSaleWorkType}.PreSaleWorkPrice:{ PreSaleWorkPrice}. Id: { Id}", model.PreSaleWorkType, model.PreSaleWorkPrice, model.Id);
|
||||
|
||||
var element = _PreSaleWorkStorage.GetElement(new PreSaleWorkSearchModel
|
||||
{
|
||||
PreSaleWorkType = model.PreSaleWorkType
|
||||
});
|
||||
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Предпродажная работа с таким типом уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs
Normal file
127
CarCenter/CarCenterBusinessLogic/BusinessLogics/SaleLogic.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using CarCenterContracts.BindingModels;
|
||||
using CarCenterContracts.BusinessLogicsContracts;
|
||||
using CarCenterContracts.SearchModels;
|
||||
using CarCenterContracts.StoragesContracts;
|
||||
using CarCenterContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace CarCenterBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class SaleLogic : ISaleLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISaleStorage _SaleStorage;
|
||||
private readonly IManagerLogic _managerLogic;
|
||||
|
||||
public SaleLogic(ILogger<SaleLogic> logger, ISaleStorage SaleStorage, IManagerLogic ManagerLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_SaleStorage = SaleStorage;
|
||||
_managerLogic = ManagerLogic;
|
||||
}
|
||||
|
||||
public bool Create(SaleBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
var result = _SaleStorage.Insert(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(SaleBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
|
||||
var result = _SaleStorage.Delete(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public SaleViewModel? ReadElement(SaleSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
_logger.LogInformation("ReadElement. SaleFIO:{SaleFIO}.Id:{Id}", model.SaleDate, model.Id);
|
||||
|
||||
var element = _SaleStorage.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<SaleViewModel>? ReadList(SaleSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. SaleFIO:{SaleFIO}.Id:{ Id}", model?.SaleDate, model?.Id);
|
||||
|
||||
var list = model == null ? _SaleStorage.GetFullList() : _SaleStorage.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(SaleBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_SaleStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(SaleBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(model.SalePrice))
|
||||
{
|
||||
throw new ArgumentNullException("Не указана цена продажи", nameof(model.SalePrice));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Sale. SaleFIO:{SaleFIO}.SalePrice:{ SalePrice}. Id: { Id}", model.SaleDate, model.SalePrice, model.Id);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user