Esempio n. 1
0
        public Plate UpdatePlate(UpdatePlate updatePlate)
        {
            if (updatePlate.AccelerometerIds != null)
            {
                var accelerometers = _accelerometerService.GetAccelerometersByIds
                                         (updatePlate.AccelerometerIds);
                if (accelerometers.Any(a => a.Plate != null))
                {
                    throw new Exception();
                }
                updatePlate.Accelerometer = accelerometers;
            }

            if (updatePlate.GyroscopeIds != null)
            {
                var gyroscopes = _gyroscopeService.GetGyroscopeByIds(updatePlate.GyroscopeIds);
                if (gyroscopes.Any(a => a.Plate != null))
                {
                    throw new Exception();
                }
                updatePlate.Gyroscope = gyroscopes;
            }

            return(_plateRepository.UpdatePlate(updatePlate));
        }