This commit is contained in:
bekodeg 2024-05-01 18:18:25 +04:00
parent 0cf11372a7
commit 311b70d3be
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
public ComponentViewModel? Insert(ComponentBindingModel model) public ComponentViewModel? Insert(ComponentBindingModel model)
{ {
using var context = new ComputerHardwareStoreDBContext(); using var context = new ComputerHardwareStoreDBContext();
var newComponent = Component.Create(context, model); var newComponent = Component.Create(model);
if (newComponent == null) if (newComponent == null)
{ {
return null; return null;

View File

@ -27,7 +27,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
} }
using var context = new ComputerHardwareStoreDBContext(); using var context = new ComputerHardwareStoreDBContext();
return context.Products return context.Products
.Where(p => (p.StoreKeeperId == model.StoreKeeperId) .Where(p => (p.StoreKeeper.Id == model.StoreKeeperId)
// есть хотя бы 1 общий со сборкой компонент // есть хотя бы 1 общий со сборкой компонент
&& (!model.BuildId.HasValue || p.Components.FirstOrDefault && (!model.BuildId.HasValue || p.Components.FirstOrDefault
(c => c.Component.BuldComponents.FirstOrDefault( (c => c.Component.BuldComponents.FirstOrDefault(