public async Task <IActionResult> PutClasses([FromRoute] int id, [FromBody] Classes classes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != classes.IntId) { return(BadRequest()); } _context.Entry(classes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutStudents([FromRoute] int id, [FromBody] Students students) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != students.IntId) { return(BadRequest()); } _context.Entry(students).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentsExists(id)) { return(NotFound("Update failed")); } else { throw; } } return(Ok("Update success")); }