Example #1
0
        public ActionResult <IEnumerable <AuthorDto> > GetAuthors([FromQuery] AuthorsResourceParameters parameters)
        {
            var authorsFromRepo = _coursesLibraryRepository.GetAuthors(parameters);

            var authors = _mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo);

            return(Ok(authors));
        }
        public ActionResult <IEnumerable <Author> > GetAuthorsCollection(
            [FromRoute][ModelBinder(BinderType = typeof(ArrayModelBinder))]
            IEnumerable <Guid> ids)
        {
            if (ids == null)
            {
                return(BadRequest());
            }

            var authors = _coursesLibraryRepository.GetAuthors(ids);

            if (ids.Count() != authors.Count())
            {
                return(NotFound());
            }

            return(Ok(authors));
        }