поиск компонентов и покупок по юзерам

This commit is contained in:
dex_moth 2024-05-27 20:30:16 +04:00
parent 0721ac8f89
commit bcd8b8f156
2 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,8 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
} }
using var context = new ComputerHardwareStoreDBContext(); using var context = new ComputerHardwareStoreDBContext();
return context.Components return context.Components
.Where(c => c.Name.Contains(model.Name)) .Where(c => c.Name.Contains(model.Name) ||
(c.StoreKeeper.Id == model.StoreKeeperId))
.Select(c => c.GetViewModel) .Select(c => c.GetViewModel)
.ToList(); .ToList();
} }

View File

@ -30,6 +30,7 @@ namespace ComputerHardwareStoreDatabaseImplement.Implements
.Include(p => p.Products) .Include(p => p.Products)
.ThenInclude(p => p.Product) .ThenInclude(p => p.Product)
.Where(p => .Where(p =>
(model.VendorId.HasValue && model.VendorId == p.VendorId) ||
(model.Id.HasValue && p.Id == model.Id) || (model.Id.HasValue && p.Id == model.Id) ||
((model.DateFrom.HasValue && model.DateTo.HasValue) && ((model.DateFrom.HasValue && model.DateTo.HasValue) &&
((model.DateFrom <= p.DateCreate && p.DateCreate <= model.DateTo) || ((model.DateFrom <= p.DateCreate && p.DateCreate <= model.DateTo) ||