This commit is contained in:
Sergey Kozyrev 2024-04-30 22:12:18 +04:00
parent 1a18c24f37
commit f38b3743cd

View File

@ -36,7 +36,7 @@ namespace DatabaseImplement.Implements
}
using var context = new FactoryGoWorkDatabase();
if (model.DetailId.HasValue)
return context.Workshops.Include(x => x.Production).Where(x => x.Production.Details.FirstOrDefault(y => y.DetailId == model.DetailId) != null).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
return context.Workshops.Where(x => x.ProductionId != null).Include(x => x.Production).Where(x => x.Production!.Details.FirstOrDefault(y => y.DetailId == model.DetailId) != null).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
else
return context.Workshops.Include(x => x.Workers).ThenInclude(x => x.Worker).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
}