Ejemplo n.º 1
0
        /// <summary>
        /// Returns grade and Semester details of a particular student
        /// </summary>
        /// <param name="studentID">ID of a particular Student</param>
        /// <returns>Generic list of type Grade View model</returns>
        /// <exception cref="Exception">Handles Exception</exception>
        public List <GradeVM> GetSemGrades(string studentID)
        {
            List <GradeVM> result = new List <GradeVM>();

            try
            {
                var gradeList = studentDataService.GetGradeData().Where(gradeDetails =>
                                                                        gradeDetails.studentId.Equals(studentID)
                                                                        );
                var semesterList = studentDataService.GetSemesterData();

                result = gradeList.Join(
                    semesterList,
                    grade => grade.semesterId,
                    semester => semester.semesterId,

                    (grade, semester) => new GradeVM
                {
                    grade            = grade.grade,
                    semesterName     = semester.semesterName,
                    semesterMontYear = semester.semesterMontYear
                }
                    ).ToList();
            }
            catch (Exception exception)
            {
                log.Info("\n----------Exception------\n");
                log.Error(exception.ToString());
            }
            return(result);
        }