public async Task <IActionResult> PutTemperatureSensor(int id, TemperatureSensor temperatureSensor) { if (id != temperatureSensor.Id) { return(BadRequest()); } _context.Entry(temperatureSensor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TemperatureSensorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutRecord(long id, Record @record) { if (id != @record.TimeStamp) { return(BadRequest()); } _context.Entry(@record).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecordExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }