public async Task <IActionResult> PutElementoPermitido([FromRoute] int id, [FromBody] ElementoPermitido elementoPermitido) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != elementoPermitido.Id) { return(BadRequest()); } _context.Entry(elementoPermitido).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElementoPermitidoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostElementoPermitido([FromBody] ElementoPermitido elementoPermitido) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ElementoPermitido.Add(elementoPermitido); await _context.SaveChangesAsync(); return(CreatedAtAction("GetElementoPermitido", new { id = elementoPermitido.Id }, elementoPermitido)); }