public async Task <IActionResult> PutEnrollment(int id, 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()); }
public async Task <IActionResult> PutCourse(int id, Course course) { if (id != course.Id) { return(BadRequest()); } _context.Entry(course).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTeacher(int id, 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()); }