示例#1
0
        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));
        }
示例#2
0
        public IHttpActionResult GetStudents(int courseID)
        {
            List <StudentDTO> students = null;

            try
            {
                students = _service.GetStudentsByCourse(courseID);
            }
            catch (AppObjectNotFoundException)
            {
                return(NotFound());
            }

            return(Ok(students));
        }