aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/EntitiesExtensions/HardwareVersion.cs
blob: c3254db2040df23d030156cf4d506431ebcdf08e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.BL.Entities
{
    public partial class HardwareVersion
    {
        public override HardwareVersion Clone()
        {
            var cloned = base.Clone();
            cloned.HardwareMotors = HardwareMotors.Select(x => x.Clone()).ToObservableCollection();
            cloned.HardwareDancers = HardwareDancers.Select(x => x.Clone()).ToObservableCollection();
            cloned.HardwarePidControls = HardwarePidControls.Select(x => x.Clone()).ToObservableCollection();
            cloned.HardwareWinders = HardwareWinders.Select(x => x.Clone()).ToObservableCollection();
            cloned.HardwareSpeedSensors = HardwareSpeedSensors.Select(x => x.Clone()).ToObservableCollection();
            return cloned;
        }

        public override void Delete(ObservablesContext context)
        {
            HardwareDancers.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareMotors.ToList().ForEach(x => x.DefferedDelete(context));
            HardwarePidControls.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareWinders.ToList().ForEach(x => x.DefferedDelete(context));
            HardwareSpeedSensors.ToList().ForEach(x => x.DefferedDelete(context));
            base.Delete(context);
        }
    }
}