public IActionResult GetStudentGradesForCourse(int courseId) { var userId = 0; if (Int32.TryParse(HeaderValueReader.GetUserId(Request), out userId)) { var grades = facultyService.GetStudentGradesForCourse(userId, courseId); return(Ok(mapper.Map <IEnumerable <GradeModel> >(grades))); } return(BadRequest(new { message = "Something went wrong when trying to get student grades for course" })); }