Ejemplo n.º 1
0
        /// <summary>
        /// Returns Course details of a particular Department
        /// </summary>
        /// <param name="departmentID">ID of a particular Department</param>
        /// <returns>Generic list of type Course View model</returns>
        /// <exception cref="Exception">Handles Exception</exception>
        public List <CourseVM> GetDepartmentCourses(string departmentID)
        {
            List <CourseVM> courseList = new List <CourseVM>();

            try
            {
                courseList = studentDataService.GetCourseData().Where(course =>
                                                                      course.departmentId.Equals(departmentID)
                                                                      ).Select(course => new CourseVM
                {
                    courseId     = course.courseId,
                    courseName   = course.courseName,
                    semesterId   = course.semesterId,
                    departmentId = course.departmentId
                }).ToList();
            }
            catch (Exception exception)
            {
                log.Info("\n----------Exception------\n");
                log.Error(exception.ToString());
            }
            return(courseList);
        }