public Accelerometer CreateAccelerometer(Accelerometer accelerometer) { if (accelerometer.PlateId != null) { accelerometer.Plate = _plateRepository.GetPlate(accelerometer.PlateId); } return(_accelerometerRepository.CreateAccelerometer(accelerometer)); }
public Gyroscope CreateGyroscope(Gyroscope gyroscope) { if (gyroscope.PlateId != null) { gyroscope.Plate = _plateRepository.GetPlate(gyroscope.PlateId); } return(_gyroscopeRepository.CreateGyroscope(gyroscope)); }
public IActionResult GetPlatePatterns(int id) { if (id <= 0) { return(NotFound()); } // // TODO: Remove these 2 queries and combine them to one // var currentPlate = _plateRepository.GetPlate(id); if (currentPlate == null) { return(NotFound()); } var currentPatterns = new List <PlaterPatternDataModel>(_platePatternRepository.GetPlatePatterns(id)); var platePatterns = new { currentPlate.Id, currentPlate.Name, currentPlate.MinCharacters, currentPlate.MaxCharacters, Patterns = currentPatterns.Select(y => new { y.Name, y.Pattern }) }; return(Ok(platePatterns)); }
public Plate GetPlate(string id) { return(_plateRepository.GetPlate(id)); }