From aa85143ff3232ad3587e2d9b278616d23a603af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20=C5=A0taleker?= Date: Wed, 4 Mar 2026 20:27:54 +0100 Subject: [PATCH] brisanje pobrise se operacije --- EveryThing/Pages/Projects/Edit.cshtml.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/EveryThing/Pages/Projects/Edit.cshtml.cs b/EveryThing/Pages/Projects/Edit.cshtml.cs index d366ba5..fcd9a3d 100644 --- a/EveryThing/Pages/Projects/Edit.cshtml.cs +++ b/EveryThing/Pages/Projects/Edit.cshtml.cs @@ -643,12 +643,16 @@ namespace EveryThing.Pages.Projects && x.Project.IdCompanyFk == user.IdCompanyFk); if (projectPart != null) - { - foreach (var projectPartItem in _context.ProjectPartItems.Where(x => x.IdProjectPartFk == projectPart.IdProjectPart).ToList()) { - _context.ProjectPartItems.Remove(projectPartItem); - } - _context.ProjectParts.Remove(projectPart); + foreach (var projectPartItem in _context.ProjectPartItems.Where(x => x.IdProjectPartFk == projectPart.IdProjectPart).ToList()) + { + var operations = _context.ProjectPartItemOperations + .Where(x => x.IdProjectPartItemFk == projectPartItem.IdProjectPartItem) + .ToList(); + _context.ProjectPartItemOperations.RemoveRange(operations); + _context.ProjectPartItems.Remove(projectPartItem); + } + _context.ProjectParts.Remove(projectPart); _context.SaveChanges(); projectPart.Project = null;