public async Task <IActionResult> PutStudent(int id, Student student) { if (id != student.StudentId) { return(BadRequest()); } _context.Entry(student).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCourse(int id, Course course) { if (id != course.CourseId) { return(BadRequest()); } _context.Entry(course).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }