public async Task <IActionResult> PutSubfuncion([FromRoute] int id, [FromBody] Subfuncion subfuncion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subfuncion.ID) { return(BadRequest()); } _context.Entry(subfuncion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubfuncionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSubfuncion([FromBody] Subfuncion subfuncion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.subfuncion.Add(subfuncion); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSubfuncion", new { id = subfuncion.ID }, subfuncion)); }