Esempio n. 1
0
        private Services.ClassRoom GetClassroom(ProfScreenViewModel model)
        {
            var classes  = _classroomRepository.GetAllClassrooms().OrderBy(c => c.className);
            var students = _studentRepository.GetAllStudents().OrderBy(s => s.classId);

            model = new ProfScreenViewModel()
            {
                Classrooms = classes.ToList(),
                Students   = students.ToList()
            };

            string className = model.Classrooms.ElementAt(model.classId).className;
            string orgName   = model.Classrooms.ElementAt(model.classId).orgName;

            int classId = _classroomRepository.GetIdByName(className);

            IEnumerable <Models.Students.Student>   ClassStudents = _studentRepository.GetAllStudentsInClass(classId);
            List <Models.Students.Student>          studentList   = ClassStudents.ToList();
            ObservableCollection <Services.Student> classStuds    = new ObservableCollection <Services.Student>();

            foreach (Models.Students.Student s in studentList)
            {
                Services.Student tempStudent = new Services.Student(s.name, s.githubUrsName, s.githubEmail);
                classStuds.Add(tempStudent);
            }


            return(new Services.ClassRoom(orgName, className, classStuds));
        }
Esempio n. 2
0
 public async Task <int> UpdateAsync(Student student)
 {
     return(await studentRepository.UpdateAsync(student));
 }
Esempio n. 3
0
 public async Task <int> InsertAsync(Student student)
 {
     return(await studentRepository.InsertAsync(student));
 }
Esempio n. 4
0
 public void RemoveStudent(Student student)
 {
     _dbContext.Students.Remove(student);
     _dbContext.SaveChanges();
 }
Esempio n. 5
0
 public void UpdateStudent(Student student)
 {
     _dbContext.Students.AddOrUpdate(student);
     _dbContext.SaveChanges();
 }
Esempio n. 6
0
 public void InsertStudent(Student student)
 {
     _dbContext.Students.Add(student);
     _dbContext.SaveChanges();
 }