DB integration added, multiple images for equipment
This commit is contained in:
@@ -1,34 +1,30 @@
|
||||
using GazpromApp.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace GazpromApp.Utils
|
||||
{
|
||||
public static class PropertyParentHelper
|
||||
{
|
||||
public static void SetPropertyParents(this Point point)
|
||||
{
|
||||
// Set parents for properties in point
|
||||
foreach (var prop in point.Properties)
|
||||
{
|
||||
SetParentsRecursively(prop);
|
||||
}
|
||||
namespace GazpromApp.Utils;
|
||||
|
||||
// Set parents for properties in equipment
|
||||
foreach (var prop in point.Equipment.SelectMany(equipment => equipment.Properties))
|
||||
{
|
||||
SetParentsRecursively(prop);
|
||||
}
|
||||
public static class PropertyParentHelper
|
||||
{
|
||||
public static void SetPropertyParents(this Point point)
|
||||
{
|
||||
foreach (var prop in point.Properties)
|
||||
{
|
||||
SetParentsRecursively(prop);
|
||||
}
|
||||
|
||||
private static void SetParentsRecursively(Property property)
|
||||
foreach (var prop in point.Equipment.SelectMany(equipment => equipment.Properties))
|
||||
{
|
||||
foreach (var childProp in property.Properties)
|
||||
{
|
||||
childProp.Parent = property;
|
||||
childProp.ParentId = property.Id;
|
||||
SetParentsRecursively(childProp);
|
||||
}
|
||||
SetParentsRecursively(prop);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetParentsRecursively(Property property)
|
||||
{
|
||||
foreach (var childProp in property.Properties)
|
||||
{
|
||||
childProp.Parent = property;
|
||||
childProp.ParentPropertyId = property.Id;
|
||||
SetParentsRecursively(childProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user