示例#1
0
        public ActionResult <IEnumerable <CourseDto> > GetCourseForAuthor(Guid authorId)
        {
            if (!_repository.AuthorExist(authorId))
            {
                return(NotFound());
            }

            var coursesFromRepo = _repository.GetCoursesForAuthor(authorId);

            return(_mapper.Map <List <CourseDto> >(coursesFromRepo));
        }
        public ActionResult <IEnumerable <CoursesDto> > GetCourses(Guid authorId)
        {
            var authors = _courseLibraryRepository.AuthorExist(authorId);

            if (!authors)
            {
                return(NotFound());
            }

            var coursesFromRepo = _courseLibraryRepository.GetCourses(authorId);

            return(Ok(_mapper.Map <IEnumerable <CoursesDto> >(coursesFromRepo)));
        }