public async Task <IActionResult> PutTempData([FromRoute] int id, [FromBody] TempData tempData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tempData.Id) { return(BadRequest()); } _context.Entry(tempData).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TempDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTemperature(long id, Temperature temperature) { if (id != temperature.Id) { return(BadRequest()); } _context.Entry(temperature).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TemperatureExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }