Exemple #1
0
        public Course GetCourse(int id)
        {
            ILearningRepository repository = new LearningRepository(new LearningContext());
            var course = repository.GetCourse(id, false);

            return(course);
        }
Exemple #2
0
        public IHttpActionResult GetCourse(int courseId)
        {
            var course = LearningRepository.GetCourse(courseId);

            if (course == null)
            {
                return(NotFound());
            }

            return(Ok(new
            {
                course.Id,
                course.Name
            }));
        }
Exemple #3
0
        public List <Course> Get()
        {
            ILearningRepository repository = new LearningRepository(new LearningContext());

            return(repository.GetAllCourses().ToList());
        }
Exemple #4
0
        public IHttpActionResult GetAll()
        {
            var courses = LearningRepository.GetAllCourses().Select(x => new { x.Id, x.Name });

            return(Ok(courses));
        }