Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingDataSynchronizationService.cs =================================================================== diff -u -ra9ab2d906323a908ed5e7a245b5813380776961a -r036199c1cde97f98829dc4405169ec327d2a1b95 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingDataSynchronizationService.cs (.../PipingDataSynchronizationService.cs) (revision a9ab2d906323a908ed5e7a245b5813380776961a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingDataSynchronizationService.cs (.../PipingDataSynchronizationService.cs) (revision 036199c1cde97f98829dc4405169ec327d2a1b95) @@ -181,6 +181,38 @@ } /// + /// Removes all from the + /// and clears all data that depends on it, either directly or indirectly. + /// + /// The failure mechanism. + /// All objects that are affected by this operation. + /// Thrown when + /// is null. + public static IEnumerable RemoveAllSurfaceLines(PipingFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + IEnumerable affectedCalculationScenarios = + failureMechanism.Calculations + .Cast() + .Where(calc => calc.InputParameters.SurfaceLine != null).ToArray(); + + var affectedObjects = new List(); + foreach (PipingCalculation calculation in affectedCalculationScenarios) + { + affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation)); + affectedObjects.AddRange(ClearSurfaceLine(calculation.InputParameters)); + } + + failureMechanism.SurfaceLines.Clear(); + affectedObjects.Add(failureMechanism.SurfaceLines); + return affectedObjects; + } + + /// /// Removes a given from the /// and clears all data that depends on it, either directly or indirectly. ///