internal static bool UpdateStudent(Student ChangedStudent) { try { context.SaveChanges(); return(true); } catch (Exception exc) { return(false); } }
internal static bool RemoveStudents(List <int> SelectedStudentsId) { try { foreach (var id in SelectedStudentsId) { var delStudent = new Student() { IdStudent = id }; context.Students.Attach(delStudent); context.Students.Remove(delStudent); context.SaveChanges(); } return(true); } catch (Exception exc) { return(false); } }
internal static void AddStudent(Student newStudent) { context.Students.Add(newStudent); context.SaveChanges(); }