public void DeletePlate(string id) { var plate = GetPlate(id); if (plate is null) { throw new ArgumentException ($"MobileTestingProduct with id = {id} doesn't exist"); } if (plate.Gyroscope != null) { foreach (var gyroscopeId in plate.Gyroscope.Select(g => g.Id).ToList()) { _gyroscopeService.DeleteGyroscope(gyroscopeId); } } if (plate.Accelerometer != null) { foreach (var accelerometerId in plate.Accelerometer.Select(a => a.Id).ToList()) { _accelerometerService.DeleteAccelerometer(accelerometerId); } } _plateRepository.DeletePlate(id); }
public void DeleteGyroscope(string id) { _gyroscopeService.DeleteGyroscope(id); }