public async Task <IActionResult> PutPlanoDeEnsino([FromRoute] int id, [FromBody] PlanoDeEnsino planoDeEnsino) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != planoDeEnsino.PlanoEnsinoId) { return(BadRequest()); } _context.Entry(planoDeEnsino).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanoDeEnsinoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPlanoDeEnsino([FromBody] PlanoDeEnsino planoDeEnsino) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.PlanoDeEnsino.Add(planoDeEnsino); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlanoDeEnsino", new { id = planoDeEnsino.PlanoEnsinoId }, planoDeEnsino)); }