Storage fixes.

This commit is contained in:
Yuee Shiness 2023-05-20 06:20:52 +04:00
parent f82fc6157c
commit e36877d0db
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ namespace ComputerStoreDatabaseImplement.Implements
{
return context.PCS.Include(x => x.Employee).Include(x => x.Request).ThenInclude(x => x.PCs).ThenInclude(x => x.Component).Where(x => x.EmployeeID == model.EmployeeID).Select(x => x.GetViewModel).ToList();
}
return context.PCS.Include(x => x.Employee).Include(x => x.Request).ThenInclude(x => x.PCs).ThenInclude(x => x.Component).Where(p => context.Requests.Where(r => context.Orders.Where(o => o.DateCreate >= model.DateFrom && o.DateCreate <= model.DateTo).Select(o => o.ID).Contains(r.OrderID)).Select(r => r.ID).Contains(p.RequestID)).ToList().Select(x => x.GetViewModel).ToList();
return context.PCS.Include(x => x.Employee).Include(x => x.Request).ThenInclude(x => x.PCs).ThenInclude(x => x.Component).Include(x => x.Request).ThenInclude(x => x.Order).Where(x => x.Request != null && x.Request.Order.DateCreate >= model.DateFrom && x.Request.Order.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
}
public List<PCViewModel> GetFullList()

View File

@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
@ -38,7 +39,7 @@ namespace ComputerStoreDatabaseImplement.Implements
{
return context.Products.Include(x => x.Employee).Include(x => x.Components).ThenInclude(x => x.Component).Where(p => context.ProductComponents.Where(pc => pc.ComponentID == model.ComponentID).Select(pc => pc.ProductID).Contains(p.ID)).Select(x => x.GetViewModel).ToList();
}
return context.Products.Include(x => x.Employee).Include(x => x.Components).ThenInclude(x => x.Component).Where(p =>context.ConsignmentProducts.Where(cp => context.Consignments.Where(c => context.Orders.Where(o => o.DateCreate >= model.DateFrom && o.DateCreate <= model.DateTo).Select(o => o.ID).Contains(c.OrderID)).Select(c => c.ID).Contains(cp.ConsignmentID)).Select(cp => cp.ProductID).Contains(p.ID)).ToList().Select(x => x.GetViewModel).ToList();
return context.Products.Include(x => x.Employee).Include(x => x.Components).ThenInclude(x => x.Component).Include(x => x.Consignments).ThenInclude(x => x.Consignment).ThenInclude(x => x.Order).Where(x => x.Consignments.Count != 0 && x.Consignments.First().Consignment.Order.DateCreate >= model.DateFrom && x.Consignments.First().Consignment.Order.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
}
public List<ProductViewModel> GetFullList()