/// <summary> /// Creates the student grade item grade display model. /// </summary> /// <param name="grade">The grade.</param> /// <param name="courseId">The course identifier.</param> /// <returns></returns> public StudentGradeItemGrade CreateStudentGradeItemGrade(GradeItemGrade grade, int courseId) { var courseRepo = new CourseRepository(); var gradeItem = this.GetGradeItem(grade.assignmentID); var student = courseRepo.LocalGetStudentById(grade.studentID); var name = student.FirstName + " " + student.LastName; var gradeItemname = gradeItem.Name; var course = courseId; var oldgrade = grade.Grade; var studentGrade = new StudentGradeItemGrade(name, course.ToString(), gradeItemname, grade.assignmentID, grade.studentID, oldgrade); return(studentGrade); }
/// <summary> /// Gets the student grade item grades. /// </summary> /// <param name="courseId">The course identifier.</param> /// <returns></returns> public IList <StudentGradeItemGrade> GetStudentGradeItemGrades(int courseId) { var courseRepo = new CourseRepository(); List <StudentGradeItemGrade> studentGrades = new List <StudentGradeItemGrade>(); List <GradeItemGrade> grades = (List <GradeItemGrade>) this.GetAllGradeItemGradeByCourse(courseId); foreach (var grade in grades) { var gradeItem = this.GetGradeItem(grade.assignmentID); var student = courseRepo.LocalGetStudentById(grade.studentID); var name = student.FirstName + " " + student.LastName; var gradeItemname = gradeItem.Name; var course = courseId; var oldgrade = grade.Grade; var studentGrade = new StudentGradeItemGrade(name, course.ToString(), gradeItemname, grade.assignmentID, grade.studentID, oldgrade); studentGrades.Add(studentGrade); } return(studentGrades); }