public async Task <IActionResult> PutDeteccao([FromRoute] int id, [FromBody] Deteccao deteccao) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deteccao.DetecaoTipoId) { return(BadRequest()); } _context.Entry(deteccao).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeteccaoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostDeteccao([FromBody] Deteccao deteccao) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Deteccao.Add(deteccao); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDeteccao", new { id = deteccao.DetecaoTipoId }, deteccao)); }