public async Task <IActionResult> PutBatteries(string id, Battery batteries) { if (id != batteries.BatteryId) { return(BadRequest()); } _context.Entry(batteries).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BatteryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutElectricVehicleReading(string id, ElectricVehicleReading batteryDataTemplate) { if (id != batteryDataTemplate.ElectricVehicleReadingId) { return(BadRequest()); } _context.Entry(batteryDataTemplate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EVReadingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPowerReadings(string id, PowerReadings loadDataTemplate) { if (id != loadDataTemplate.PowerReadingId) { return(BadRequest()); } _context.Entry(loadDataTemplate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PowerReadingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Thermostat> > PutThermostats(Thermostat tstatChannelDeviceMap) { if (ThermostatExists(tstatChannelDeviceMap.ThermostatId)) { _context.Entry(tstatChannelDeviceMap).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(tstatChannelDeviceMap); }
public async Task <ActionResult <WaterHeaterReading> > PutWaterHeaterReading(WaterHeaterReading waterheaterDataTemplate) { if (WaterHeaterReadingExists(waterheaterDataTemplate.WaterHeaterReadingId)) { _context.Entry(waterheaterDataTemplate).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(waterheaterDataTemplate); }
public async Task <ActionResult <ThermostatReading> > PutThermostatReadings(ThermostatReading tstatDataTemplate) { if (ThermostatReadingExists(tstatDataTemplate.ThermostatReadingId)) { _context.Entry(tstatDataTemplate).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(tstatDataTemplate); }
public async Task <ActionResult <Loads> > PutLoads(Loads loadChannelDeviceMap) { if (LoadExists(loadChannelDeviceMap.LoadId)) { _context.Entry(loadChannelDeviceMap).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } } return(loadChannelDeviceMap); }
public async Task <ActionResult <PricingSignals> > PutPricingSignals(PricingSignals pricingsignal) { if (PricingSignalsExists(pricingsignal.PricingSignalId)) { _context.Entry(pricingsignal).State = EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(pricingsignal); }
public async Task <ActionResult <SolarPv> > PutSolarPv(SolarPv batteries) { if (SolarPvExists(batteries.SolarPvId)) { _context.Entry(batteries).State = EntityState.Modified; } else { return(NotFound()); } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(batteries); }
public async Task <ActionResult <WaterHeater> > PutWaterheaters(WaterHeater waterheater) { if (WaterheaterExists(waterheater.WaterHeaterId)) { _context.Entry(waterheater).State = EntityState.Modified; } else { return(NotFound()); } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(waterheater); }
public async Task <ActionResult <SolarPvReading> > PutSolarPvReadings(SolarPvReading batteryDataTemplate) { if (SolarPvReadingExists(batteryDataTemplate.SolarPvReadingId)) { _context.Entry(batteryDataTemplate).State = EntityState.Modified; } else { return(NotFound()); } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(batteryDataTemplate); }
public async Task <IActionResult> PutElectricVehicle(ElectricVehicle batteries) { _context.Entry(batteries).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EVExists(batteries.ElectricVehicleId)) { return(NotFound()); } else { throw; } } return(NoContent()); }