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)); }
public async Task <int> UpdateAsync(Student student) { return(await studentRepository.UpdateAsync(student)); }
public async Task <int> InsertAsync(Student student) { return(await studentRepository.InsertAsync(student)); }
public void RemoveStudent(Student student) { _dbContext.Students.Remove(student); _dbContext.SaveChanges(); }
public void UpdateStudent(Student student) { _dbContext.Students.AddOrUpdate(student); _dbContext.SaveChanges(); }
public void InsertStudent(Student student) { _dbContext.Students.Add(student); _dbContext.SaveChanges(); }