public async Task <IActionResult> PutPlanoDeAula([FromRoute] int id, [FromBody] PlanoDeAula planoDeAula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != planoDeAula.PlanoId) { return(BadRequest()); } _context.Entry(planoDeAula).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanoDeAulaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPlanoDeAula([FromBody] PlanoDeAula planoDeAula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.PlanoDeAula.Add(planoDeAula); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlanoDeAula", new { id = planoDeAula.PlanoId }, planoDeAula)); }