From f38b3743cd3433e16ec38c2c8a661577d5eb6a80 Mon Sep 17 00:00:00 2001 From: Sergey Kozyrev Date: Tue, 30 Apr 2024 22:12:18 +0400 Subject: [PATCH] someback --- Course/DatabaseImplement/Implements/WorkshopStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Course/DatabaseImplement/Implements/WorkshopStorage.cs b/Course/DatabaseImplement/Implements/WorkshopStorage.cs index a8743be..eb29fcd 100644 --- a/Course/DatabaseImplement/Implements/WorkshopStorage.cs +++ b/Course/DatabaseImplement/Implements/WorkshopStorage.cs @@ -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(); }