Ejemplo n.º 1
0
        public IHttpActionResult GetCoursesClassroomsForTeacher(int teacherId)
        {
            var userData = IdentityHelper.GetLoggedInUser(RequestContext);

            logger.Info("Get Courses and classrooms data for teacher {@teacherId} by {@userData}", teacherId, userData);

            if (userData.UserId != teacherId && userData.UserRole == "teachers")
            {
                throw new UnauthorizedAccessException("You are not allowed to access other teachers data");
            }

            return(Ok(teachersService.GetCoursesClassRoomsForTeacher(teacherId)));
        }