Заменил модель на search в методе удаления из хранилища
This commit is contained in:
parent
fab697e3d6
commit
9b1c5ce5b9
@ -10,6 +10,6 @@ namespace InternetShopContracts.LogicsContracts
|
|||||||
OrderViewModel? ReadElement(OrderSearchModel model);
|
OrderViewModel? ReadElement(OrderSearchModel model);
|
||||||
bool Create(OrderBindingModel model);
|
bool Create(OrderBindingModel model);
|
||||||
bool Update(OrderBindingModel model);
|
bool Update(OrderBindingModel model);
|
||||||
bool Delete(OrderBindingModel model);
|
bool Delete(OrderSearchModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ namespace InternetShopContracts.LogicsContracts
|
|||||||
ProductViewModel? ReadElement(ProductSearchModel model);
|
ProductViewModel? ReadElement(ProductSearchModel model);
|
||||||
bool Create(ProductBindingModel model);
|
bool Create(ProductBindingModel model);
|
||||||
bool Update(ProductBindingModel model);
|
bool Update(ProductBindingModel model);
|
||||||
bool Delete(ProductBindingModel model);
|
bool Delete(ProductSearchModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ namespace InternetShopContracts.StorageContracts
|
|||||||
OrderViewModel? GetElement(OrderSearchModel model);
|
OrderViewModel? GetElement(OrderSearchModel model);
|
||||||
OrderViewModel? Insert(OrderBindingModel model);
|
OrderViewModel? Insert(OrderBindingModel model);
|
||||||
OrderViewModel? Update(OrderBindingModel model);
|
OrderViewModel? Update(OrderBindingModel model);
|
||||||
OrderViewModel? Delete(OrderBindingModel model);
|
OrderViewModel? Delete(OrderSearchModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ namespace InternetShopContracts.StorageContracts
|
|||||||
ProductViewModel? GetElement(ProductSearchModel model);
|
ProductViewModel? GetElement(ProductSearchModel model);
|
||||||
ProductViewModel? Insert(ProductBindingModel model);
|
ProductViewModel? Insert(ProductBindingModel model);
|
||||||
ProductViewModel? Update(ProductBindingModel model);
|
ProductViewModel? Update(ProductBindingModel model);
|
||||||
ProductViewModel? Delete(ProductBindingModel model);
|
ProductViewModel? Delete(ProductSearchModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ namespace InternetShopDatabase.Storages
|
|||||||
{
|
{
|
||||||
public class OrderStorage : IOrderStorage
|
public class OrderStorage : IOrderStorage
|
||||||
{
|
{
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new InternetShopDatabase();
|
using var context = new InternetShopDatabase();
|
||||||
var item = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
var item = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
@ -8,7 +8,7 @@ namespace InternetShopDatabase.Storages
|
|||||||
{
|
{
|
||||||
public class ProductStorage : IProductStorage
|
public class ProductStorage : IProductStorage
|
||||||
{
|
{
|
||||||
public ProductViewModel? Delete(ProductBindingModel model)
|
public ProductViewModel? Delete(ProductSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new InternetShopDatabase();
|
using var context = new InternetShopDatabase();
|
||||||
var item = context.Products.FirstOrDefault(rec => rec.Id == model.Id);
|
var item = context.Products.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
@ -25,9 +25,8 @@ namespace InternetShopLogics.Logics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(OrderBindingModel model)
|
public bool Delete(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
|
||||||
if (_orderStorage.Delete(model) == null)
|
if (_orderStorage.Delete(model) == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,9 +25,8 @@ namespace InternetShopLogics.Logics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(ProductBindingModel model)
|
public bool Delete(ProductSearchModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
|
||||||
if (_productStorage.Delete(model) == null)
|
if (_productStorage.Delete(model) == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user