public ActionResult RemoveStudent(int ClassId, int StudentId) { var adminRole = new AdminRole(); var ViewValue = adminRole.RemoveStudent2(adminRole.GetClass(ClassId), adminRole.GetStudent(StudentId)); return(RedirectToAction("Details", new { ClassId = ClassId })); }
public ActionResult Delete(int StudentId) { var adminRole = new AdminRole(); return(View(adminRole.GetStudent(StudentId))); }
public ActionResult ListStudentSav(ClassWithStudentsVM maClasseStudent) { var adminRole = new AdminRole(); adminRole.UpdateClassAttendence(maClasseStudent.Classe.ClassId, maClasseStudent.Students.Where(x => x.Subscribed == true).Select(x => adminRole.GetStudent(x.StudentId)).ToList()); //var existingStudent = adminRole.GetStudentsOfClass(maClasseStudent.Classe.ClassId).Select(x=>x.StudentId); //var deletedStudent = Queryable.Except<Student>(existingStudent.AsQueryable(), maClasseStudent.Students.Where(x=>x.Subscribed == true).Select(x => x.StudentId)).ToList(); ////var addedStudent = maClasseStudent.Students.Where(a => a.Subscribed == true); //for (var i = 0; i < maClasseStudent.Students.Count(); i++) //{ // if (maClasseStudent.Students[i].Subscribed == false) // { // var ViewValue1 = adminRole.RemoveStudent(maClasseStudent.Classe.ClassId, maClasseStudent.Students[i].StudentId); // } // else // { // var ViewValue2 = adminRole.AddStudent2(adminRole.GetClass(maClasseStudent.Classe.ClassId), adminRole.GetStudent(maClasseStudent.Students[i].StudentId)); // } //} return(RedirectToAction("Details", new { ClassId = maClasseStudent.Classe.ClassId })); }