public async Task ProvisioningQueueAdd(SensorModuleConfig config) { using var storedProcedure = Connection.CreateStoredProcedure(ProcedureNameSensorModuleProvisioningQueueAdd, new[] { new StoredProcedureParameter("@serialNumber", config.SerialNumber), new StoredProcedureParameter("@name", config.Name), new StoredProcedureParameter("@location", config.Location), new StoredProcedureParameter("@room", config.Room), new StoredProcedureParameter("@numberTemperatureSensors", config.SensorConfig?.TemperatureSensors ?? 0), new StoredProcedureParameter("@numberHumiditySensors", config.SensorConfig?.HumiditySensors ?? 0), new StoredProcedureParameter("@numberCarbonDioxideSensors", config.SensorConfig?.CarbonDioxideSensors ?? 0), new StoredProcedureParameter("@networkType", config.NetworkType), new StoredProcedureParameter("@wirelessSsid", config.NetworkType == NetworkType.Wireless ? config.WirelessConfig?.Ssid : null), new StoredProcedureParameter("@wirelessKey", config.NetworkType == NetworkType.Wireless ? config.WirelessConfig?.Key : null), new StoredProcedureParameter("@ipType", config.IpConfigType), new StoredProcedureParameter("@ipAddress", config.IpConfigType == IpConfigType.Dhcp ? null : config.StaticIpConfig?.Address), new StoredProcedureParameter("@ipBroadcast", config.IpConfigType == IpConfigType.Dhcp ? null : config.StaticIpConfig?.Broadcast), new StoredProcedureParameter("@ipGateway", config.IpConfigType == IpConfigType.Dhcp ? null : config.StaticIpConfig?.Gateway), new StoredProcedureParameter("@ipDns", config.IpConfigType == IpConfigType.Dhcp ? null : config.StaticIpConfig?.Dns), new StoredProcedureParameter("@serverAddress", config.ServerAddress) }); await storedProcedure.ExecuteNonQueryAsync(); }
public async Task <IActionResult> ProvisioningQueueAdd([FromBody] SensorModuleConfig config) { await _sensorModuleRepository.ProvisioningQueueAdd(config); return(NoContent()); }