public async Task <IActionResult> PutTemperatureData([FromRoute] Guid id, [FromBody] TemperatureData temperatureData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != temperatureData.ID) { return(BadRequest()); } _context.Entry(temperatureData).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TemperatureDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutDevice(Guid id, Device device) { if (id != device.ID) { return(BadRequest()); } _context.Entry(device).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }