Report fix

This commit is contained in:
Илья Федотов 2024-04-30 22:48:51 +04:00
parent 3b332d1fe9
commit b007290469
5 changed files with 17 additions and 21 deletions

View File

@ -80,7 +80,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{
Name = model.Name
});
if (element != null && element.ID != model.ID) {
if (element != null && element.Name != model.Name) {
throw new InvalidOperationException("Категория с таким названием уже есть");
}

View File

@ -98,7 +98,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
_logger.LogInformation($"Product. ID:{model.ID}.ProductName:{model.ProductName}.Price:{model.Price}" +
$".CategoryID:{model.CategoryID}");
var element = _storage.GetElement(new ProductSearchModel { ProductName = model.ProductName });
if (element != null && element.ID != model.ID) {
if (element != null && element.ProductName != model.ProductName) {
throw new InvalidOperationException("Продукт с таким названием уже есть");
}
}

View File

@ -21,22 +21,18 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
_productStorag = productStorag;
}
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model) {
throw new NotImplementedException();
}
// Получение списка заказов за определенный период
public List<ReportOrdersViewModel> GerOrders(ReportBindingModel model) {
return _orderStorage.GetFilteredList(new OrderSearchModel {
DateFrom = model.DateFrom,
DateTo = model.DateTo,
}).Select(x => new ReportOrdersViewModel {
ID = x.ID,
DateCreate = x.DateCreate,
Sum = x.Sum,
PaymeantOption = x.PaymeantOption.ToString(),
OrderStatus = x.Status.ToString(),
}).ToList();
}
// Получение списка заказов за определенный период
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model) {
return _orderStorage.GetFilteredList(new OrderSearchModel {
DateFrom = model.DateFrom,
DateTo = model.DateTo,
}).Select(x => new ReportOrdersViewModel {
ID = x.ID,
DateCreate = x.DateCreate,
Sum = x.Sum,
PaymeantOption = x.PaymeantOption.ToString(),
OrderStatus = x.Status.ToString(),
}).ToList();
}
}
}

View File

@ -89,7 +89,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{
Name = model.Name
});
if (element != null && element.ID != model.ID)
if (element != null && element.Name != model.Name)
{
throw new InvalidOperationException("Такая роль уже есть");
}

View File

@ -131,7 +131,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{
Login = model.Login
});
if (element != null && element.ID != model.ID)
if (element != null && element.Login != model.Login)
{
throw new InvalidOperationException("Клиент с таким логином уже есть");
}