Example #1
0
 public List<Student> GetStudentsByTeacherUsername(string user)
 {
     var teacherId = new GetTeachers().GetTeacherIdByUsername(user);
     var markList = new GetMarks().GetMarksByTeacherId(teacherId).Where(m => m.SubjectId.Equals(1));
     List<Student> students = new List<Student>();
     foreach (var x in markList)
     {
         students.Add(GetStudentById(x.StudentId));
     }
     return students;
 }
Example #2
0
 public List<Teacher> GetTeachersByStudentId(int id)
 {
     var markList = new GetMarks().GetMarksByStudentId(id);
     //var subjectList = subjects.GetSubjectByMarkId(.id;
     List<Subject> subjectList = new List<Subject>();
     foreach(var x in markList)
     {
         subjectList.Add(new GetSubjects().GetSubjectByMarkId(x.Id));
     }
     List<Teacher> teachers = new List<Teacher>();
     foreach (var x in subjectList)
     {
         teachers.Add(GetTeacherById(x.Id));
     }
     return teachers;
 }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Student student = db.Students.Find(id);
            db.Students.Remove(db.Students.Find(id));
            var marks = new GetMarks().GetMarksByStudentId(id);
            for (int i = 0; i < marks.Count; i++)
            {
                db.StudentMark.Remove(db.StudentMark.Find(marks[i].Id));
            }

            db.SaveChanges();
            return RedirectToAction("Index");
        }