public async Task <IActionResult> PutRaspberryRecord([FromRoute] int id, [FromBody] RaspberryRecord raspberryRecord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != raspberryRecord.RecordId) { return(BadRequest()); } _context.Entry(raspberryRecord).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RaspberryRecordExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostRaspberryRecord([FromBody] RaspberryRecord raspberryRecord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.RaspberryRecord.Add(raspberryRecord); await _context.SaveChangesAsync(); return(CreatedAtAction($"GetRaspberryRecord", new { id = raspberryRecord.RecordId }, raspberryRecord)); }