Beispiel #1
0
 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());
 }
Beispiel #2
0
 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());
 }