public IActionResult GetAuthors(AuthorsResourceParameters authorResourceParameters) { var authorsFromRepo = _libraryRepository.GetAuthors(authorResourceParameters); var authors = Mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo); return(Ok(authors)); }
public IActionResult GetAuthorCollection( [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids) { if (ids == null) { return(BadRequest()); } var authorEntities = _libraryRepository.GetAuthors(ids); if (ids.Count() != authorEntities.Count()) { return(NotFound()); } var authorsToReturn = Mapper.Map <IEnumerable <AuthorDto> >(authorEntities); return(Ok(authorsToReturn)); }