public async Task <ActionResult <Afetado> > PostAfetado(Afetado afetado) { _context.Afetados.Add(afetado); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAfetado", new { id = afetado.AfetadoId }, afetado)); }
public async Task <IActionResult> PutAfetado(int id, Afetado afetado) { if (id != afetado.AfetadoId) { return(BadRequest()); } _context.Entry(afetado).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AfetadoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }