コード例 #1
0
        public List <LecturerVM> GetTeacherbyDept(string deptID)
        {
            List <LecturerVM> lecturerDetails = new List <LecturerVM>();

            try
            {
                lecturerDetails = studentDataService.GetLecturerData().Where(teacher =>
                                                                             teacher.departmentId.Equals(deptID)).Select(lecturer => new LecturerVM
                {
                    lecturerId   = lecturer.lecturerId,
                    lecturerName = lecturer.lecturerName,
                    email        = lecturer.email,
                    phoneNumber  = lecturer.phoneNumber,
                    departmentId = lecturer.departmentId,
                }
                                                                                                                         ).ToList();
            }
            catch (Exception exception)
            {
                log.Info("\n----------Exception------\n");
                log.Error(exception.ToString());
            }
            return(lecturerDetails);
        }