Report fix
This commit is contained in:
parent
3b332d1fe9
commit
b007290469
@ -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("Категория с таким названием уже есть");
|
||||
}
|
||||
|
||||
|
@ -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("Продукт с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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("Такая роль уже есть");
|
||||
}
|
||||
|
@ -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("Клиент с таким логином уже есть");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user