public async Task <IActionResult> PutTeacher([FromRoute] int id, [FromBody] Teacher teacher) { if (id != teacher.Id) { return(BadRequest()); } _context.Entry(teacher).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEnrollment([FromRoute] long id, [FromBody] Enrollment enrollment) { if (id != enrollment.Id) { return(BadRequest()); } _context.Entry(enrollment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnrollmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }