public IHttpActionResult GetStudents(int courseID) { List <StudentDTO> students = _service.GetStudentsByCourse(courseID); //Null means the course didn't exist.. if (students == null) { return(NotFound()); } return(Ok(students)); }
public IHttpActionResult GetStudents(int courseID) { List <StudentDTO> students = null; try { students = _service.GetStudentsByCourse(courseID); } catch (AppObjectNotFoundException) { return(NotFound()); } return(Ok(students)); }