public async Task <IActionResult> PutStudents(int id, Students students) { //students.Id = id; if (id != students.Id) { return(BadRequest()); } _context.Entry(students).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (Exception ex) { _logger.LogError("Testex", ex.Message); if (!StudentsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProgramGroups(int id, ProgramGroups programGroups) { if (id != programGroups.BoardID) { return(BadRequest()); } _context.Entry(programGroups).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProgramGroupsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCourses(int id, Courses courses) { if (id != courses.CourseID) { return(BadRequest()); } _context.Entry(courses).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoursesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSchools(int id, Schools schools) { if (id != schools.SchoolId) { return(BadRequest()); } _context.Entry(schools).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAssignmentPeriod(int id, AssignmentPeriod assignmentPeriod) { if (id != assignmentPeriod.AssignmentPeriodId) { return(BadRequest()); } _context.Entry(assignmentPeriod).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssignmentPeriodExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Student UpdateStudent(int id, Student studentChanges) { if (context.Students.Find(id) != null) { //var student =context.Students.Attach(studentChanges); context.Entry(studentChanges).State = EntityState.Modified; context.SaveChanges(); } return(studentChanges); }