public IActionResult GetAuthorCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids) { if (ids == null) { return(BadRequest()); } var authorEntities = _courseLibraryRepository.GetAuthors(ids).Result; //Originally, the .Result wasn't needed, but it's the best I can think of. if (ids.Count() != authorEntities.Count()) { return(NotFound()); } var authorsToReturn = _mapper.Map <IEnumerable <AuthorDto> >(authorEntities); return(Ok(authorsToReturn)); }
[HttpGet("({ids})", Name = "GetAuthorCollection")] // getting a list of Ids in the URI / query strings public IActionResult GetAuthorCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids // using custom Model binding. ) { if (ids == null) { return(BadRequest()); // if the ids could not be parsed, the reqeust was bad. } var authorEntities = _clRepo.GetAuthors(ids); if (ids.Count() != authorEntities.Count()) { return(NotFound()); } var authorsToReturn = _mapper.Map <IEnumerable <AuthorDTO> >(authorEntities); return(Ok(authorsToReturn)); }
public IActionResult GetAuthorCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinding))] IEnumerable <Guid> ids) { if (ids == null) { return(BadRequest()); } var authorEntities = _courseLibraryRepository.GetAuthors(ids); if (ids.Count() != authorEntities.Count()) { return(NotFound()); } var authorsToReturn = _mapper.Map <IEnumerable <AuthorDto> >(authorEntities); return(Ok(authorsToReturn)); }
public ActionResult GetAutorsCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> authorsIds) { if (authorsIds == null) { return(BadRequest()); } var authorsCollestion = _courseLibraryRepository.GetAuthors(authorsIds); if (authorsIds.Count() != authorsCollestion.Count()) { return(NotFound()); } var authorsDto = _mapper.Map <IEnumerable <AuthorDto> >(authorsCollestion); return(Ok(authorsDto)); }
public IActionResult GetAuthors([FromQuery] AuthorsResourceParameters authorsResourceParameters) { if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(authorsResourceParameters.OrderBy)) { return(BadRequest()); } if (!_propertyCheckerService.TypeHasProperties <AuthorDto>(authorsResourceParameters.Fields)) { return(BadRequest()); } var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorsResourceParameters); // pagination header metadata var previousPageLink = authorsFromRepo.HasPrevious ? CreateAuthorsResourceUri(authorsResourceParameters, ResourceUriType.PreviousPage) : null; var nextPageLink = authorsFromRepo.HasNext ? CreateAuthorsResourceUri(authorsResourceParameters, ResourceUriType.NextPage) : null; var paginationMetadata = new { totalCount = authorsFromRepo.TotalCount, pageSize = authorsFromRepo.PageSize, currentPage = authorsFromRepo.CurrentPage, totalPages = authorsFromRepo.TotalPages, previousPageLink, nextPageLink }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); var authors = _mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo) .ShapeData(authorsResourceParameters.Fields); return(Ok(authors)); }
public IActionResult GetAuthorsCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids) { if (ids == null) { return(BadRequest("Error in the input files")); } var authorEntities = _courseLibraryRepository.GetAuthors(ids); if (ids.Count() != authorEntities.Count()) { return(NotFound("One or more authors cannot be found")); } var authorsReturn = _mapper.Map <IEnumerable <AuthorDto> >(authorEntities); return(Ok(authorsReturn)); }
public IActionResult GetAuthors([FromQuery] AuthorParameters parameters) { if (parameters.PageNumber < 1) { ModelState.AddModelError("PageNumber", "PageNumber should not be less than 1."); return(BadRequest()); } parameters.MaximumPageSize = _configuration.GetSection("CollectionBoundaries").GetValue <int>("MaximumAuthorPageSize"); var authors = _mapper.Map <IEnumerable <AuthorDto> >(_repository.GetAuthors(parameters, out var totalCount)); var pagedList = new PagedList <AuthorDto>( authors.ToList(), parameters.PageNumber, parameters.PageSize, totalCount); Response.Headers.Add("X-Pagination", GetPaginationData(pagedList, parameters, totalCount)); return(Ok(pagedList)); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors() { var authorsFromRepo = _courseLibraryRepository.GetAuthors(); /*var authors = new List<AuhorDto>(); * * foreach(var author in authorsFromRepo) * { * authors.Add(new AuhorDto * { * Id = author.Id, * Name = $"{author.FirstName} {author.LastName}", * MainCategory = author.MainCategory, * Age = author.DateOfBirth.GetCurrentAge() * }); * * } * * return Ok(authors);*/ return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public async Task <IActionResult> GetAuthorCollection( [FromRoute] [ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids ) { if (ids == null) { return(BadRequest()); } var authorEntites = await _courseLibaryService.GetAuthors(ids); if (ids.Count() != authorEntites.Count()) { return(NotFound()); } var authorsToReturn = _mapper.Map <IEnumerable <AuthorDto> >(authorEntites); return(Ok(authorsToReturn)); }
public IActionResult GetAuthors([FromQuery] AuthorsResourceParameters authorsResourceParameters) { if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(authorsResourceParameters.OrderBy) || !_propertyCheckerService.TypeHasProperties <AuthorDto>(authorsResourceParameters.Fields)) { return(BadRequest()); } var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorsResourceParameters); var paginationMetadata = new { totalCount = authorsFromRepo.TotalCount, pageSize = authorsFromRepo.PageSize, currentPage = authorsFromRepo.CurrentPage, totalPages = authorsFromRepo.TotalPages, }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); var links = CreateLinksForAuthors(authorsResourceParameters, authorsFromRepo.HasNext, authorsFromRepo.HasPrevious); var shapedAuthors = _mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo).ShapeData(authorsResourceParameters.Fields); var shapedAuthorsWithLinks = shapedAuthors.Select(author => { var authorAsDictionary = author as IDictionary <string, object>; var authorLinks = CreateLinksForAuthor((Guid)authorAsDictionary["Id"], null); authorAsDictionary.Add("links", authorLinks); return(authorAsDictionary); }); var linkedCollectionResource = new { value = shapedAuthorsWithLinks, links }; return(Ok(linkedCollectionResource)); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors( [FromQuery] AuthorsResourceParameters authorsResourceParameters) { var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorsResourceParameters); var previousPageLink = authorsFromRepo.HasPrevious ? CreateAuthorsResourceUri(authorsResourceParameters, ResourceUriType.PreviousPage) : null; var nextPageLink = authorsFromRepo.HasNext ? CreateAuthorsResourceUri(authorsResourceParameters, ResourceUriType.NextPage) : null; var paginationMetadata = new { totalCount = authorsFromRepo.TotalCount, pageSize = authorsFromRepo.PageSize, currentPage = authorsFromRepo.CurrentPage, totalPages = authorsFromRepo.TotalPages, previousPageLink, nextPageLink }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors([FromQuery] AuthorsResourceParameters parameters) // get data of parameters from url query { var authors = _courseLibraryRepository.GetAuthors(parameters); // create a string link to the previous page var previousPageLink = authors.HasPrevious ? CreateAuthorsResourceUri(parameters, ResourceUriType.PreviosPage) : null; // create a string link to the next page var nextPageLink = authors.HasNext ? CreateAuthorsResourceUri(parameters, ResourceUriType.NextPage) : null; //collect pagination meta data var paginationMetadata = new { totalCount = authors.TotalCount, pageSize = authors.PageSize, currentPage = authors.CurrentPage, totalPages = authors.TotalPages, previousPageLink, nextPageLink }; //add meta info to the response headers Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authors))); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors([FromQuery] AuthorResourceParameter authorResourceParameter) { if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(authorResourceParameter.OrderBy)) { return(BadRequest()); } if (!_propertyCheckerService.TypeHasProperties <AuthorDto>(authorResourceParameter.Fields)) { return(BadRequest()); } var authors = _courseLibraryRepository.GetAuthors(authorResourceParameter); var result = _mapper.Map <IEnumerable <AuthorDto> >(authors).ShapeData(authorResourceParameter.Fields); var previousPageLink = authors.HasPrevious ? CreateAuthorsResourceUri(authorResourceParameter, ResourceUriType.PreviousPage) : null; var nextPageLink = authors.HasNext ? CreateAuthorsResourceUri(authorResourceParameter, ResourceUriType.NextPage) : null; var pagination = new { authors.TotalCount, authors.PageSize, authors.CurrentPage, authors.TotalPages, previousPageLink, nextPageLink, }; var metadata = JsonConvert.SerializeObject(pagination, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); Response.Headers.Add("X-Pagination", metadata); return(Ok(result)); }
public ActionResult <IEnumerable <authorDto> > GetAuthors( [FromQuery] AuthorResourseParameter authorResourseParameter) { //throw new Exception("Test exception"); var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorResourseParameter); //var authors = new List<authorDto>(); //foreach (var author in authorsFromRepo) //{ // authors.Add(new authorDto() // { // Id = author.Id, // FirstName = $"{author.FirstName}{author.LastName}", // MainCategory = author.MainCategory, // Age = author.DateOfBirth.GetCurrentAge() // }); //AutoMapper replaces above code: return(Ok(_mapper.Map <IEnumerable <authorDto> >(authorsFromRepo))); }
//public IActionResult GetAuthors() public ActionResult <IEnumerable <AuthorDto> > GetAuthors( [FromQuery] AuthorResourceParameters authorResourceParameters) //string mainCategory, string searchQuery) // Improve { //throw new Exception("Test exception"); //var authorsFromRepo = _courseLibraryRepository.GetAuthors(mainCategory, searchQuery); var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorResourceParameters); //var authors = new List<AuthorDto>(); //foreach (var author in authorsFromRepo) //{ // authors.Add(new AuthorDto() // { // Id = author.Id, // Name = $"{author.FirstName} {author.LastName}", // MainCatgory = author.MainCategory, // Age = author.DateOfBirth.GetCurrentAge() // }); //} //return new JsonResult(authorsFromRepo); //return Ok(authors); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public IActionResult GetAuthors( [FromQuery] AuthorsResourceParameters resourceParameters) { try { if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(resourceParameters.OrderBy)) { return(BadRequest()); } var authorsEntity = _courseLibraryRepository.GetAuthors(resourceParameters); var previousPageLink = authorsEntity.HasPrevious ? CreateAuthorsResourceUri(resourceParameters, ResourceUriType.PreviousPage) : null; var nextPageLink = authorsEntity.HasNext ? CreateAuthorsResourceUri(resourceParameters, ResourceUriType.NextPage) : null; var paginationMetadata = new { totalCount = authorsEntity.TotalCount, pageSize = authorsEntity.PageSize, currentPage = authorsEntity.CurrentPage, totalPages = authorsEntity.Totalpages, previousPageLink, nextPageLink }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsEntity).ShapeData(resourceParameters.Fields))); } catch (Exception ex) { return(BadRequest(ex)); } }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors([FromQuery] AuthorsResourceParameters authorsResourceParameters) { // [FromQuery] is necessary here // otherwize, complex type parameters will be assumed to be from body //throw new Exception("Test exception"); var authorsFromRepo = _courseLibraryRepository.GetAuthors(authorsResourceParameters); //var authors = new List<AuthorDto>(); //foreach (var author in authorsFromRepo) //{ // authors.Add(new AuthorDto() // { // Id = author.Id, // Name = $"{author.FirstName} {author.LastName}", // MainCategory = author.MainCategory, // Age = author.DateOfBirth.GetCurrentAge() // }); ; //} //return Ok(authors); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public async Task <ActionResult <IEnumerable <AuthorForReturn> > > GetAuthors([FromQuery] AuthorsResourceParameters parameters) { var authorsFromRepo = await _repository.GetAuthors(parameters); var authors = _mapper.Map <IEnumerable <AuthorForReturn> >(authorsFromRepo); var previousPageLink = authorsFromRepo.HasPrevious ? CreateAuthorsResourceUri(parameters, ResourceUriType.PreviousPage) : null; var nextPageLink = authorsFromRepo.HasNext ? CreateAuthorsResourceUri(parameters, ResourceUriType.NextPage) : null; var paginationMetaData = new { totalCount = authorsFromRepo.TotalCount, pageSize = authorsFromRepo.PageSize, currentPage = authorsFromRepo.CurrentPage, totalPages = authorsFromRepo.TotalPages, previousPageLink, nextPageLink }; Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(paginationMetaData)); return(Ok(authors)); }
public ActionResult <IEnumerable <AuthorDTO> > GetAuthors() { var authorsFromRepo = _courseLibraryRepository.GetAuthors(); return(Ok(_Mapper.Map <IEnumerable <AuthorDTO> >(authorsFromRepo))); }
public IActionResult GetAuthors() { var authorsFromRepo = _courseLibraryRepository.GetAuthors(); return(Ok(authorsFromRepo)); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors(string mainCathegory, string searchQuery) { var authorsFromRepo = _courseLibraryRepository.GetAuthors(mainCathegory, searchQuery); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public IActionResult GetAuthors([FromQuery] string mainCategory, string searchQuery) { var authors = courseRepository.GetAuthors(mainCategory, searchQuery); return(Ok(mapper.Map <IEnumerable <AuthorDto> >(authors))); }
public IActionResult GetAuthors( [FromQuery] AuthorsResourceParameters authorsResourceParameters, [FromHeader(Name = "Accept")] string mediaType) { if (!MediaTypeHeaderValue.TryParse(mediaType, out MediaTypeHeaderValue parsedMediaType)) { return(BadRequest()); } if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author> (authorsResourceParameters.OrderBy)) { return(BadRequest()); } if (!_propertyCheckerService.TypeHasProperties <AuthorDto>(authorsResourceParameters.Fields)) { return(BadRequest()); } var authorsFromRepository = _courseLibraryRepository.GetAuthors(authorsResourceParameters); var paginationMetadata = new { totalCount = authorsFromRepository.TotalCount, pageSize = authorsFromRepository.PageSize, currentPage = authorsFromRepository.CurrentPage, totalPages = authorsFromRepository.TotalPages }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetadata)); var includeLinks = ShouldLinksBeIncluded(parsedMediaType); IEnumerable <LinkDto> links = new List <LinkDto>(); var primaryMediaType = GetPrimaryMediaType(includeLinks, parsedMediaType); var shapedAuthors = (primaryMediaType == "vnd.shaggy.author.full") ? MapAndShapeResource <PagedList <Author>, AuthorFullDto> (authorsFromRepository, authorsResourceParameters.Fields) : MapAndShapeResource <PagedList <Author>, AuthorDto> (authorsFromRepository, authorsResourceParameters.Fields); if (includeLinks) { links = CreateLinksForAuthors( authorsResourceParameters, authorsFromRepository.HasNext, authorsFromRepository.HasPrevious); var shapedAuthorsWithLinks = shapedAuthors.Select(author => { var authorAsDictionary = author as IDictionary <string, object>; var authorLinks = CreateLinksForAuthor((Guid)authorAsDictionary["Id"], null); authorAsDictionary.Add("links", authorLinks); return(author); }); var linkedCollectionResource = new { value = shapedAuthorsWithLinks, links }; return(Ok(linkedCollectionResource)); } return(Ok(shapedAuthors)); }
public ActionResult <AuthorGetDto> GetAuthors([FromQuery] AuthorResourceParameters authorResourceParameters) { var authors = _repo.GetAuthors(authorResourceParameters); return(Ok(_mapper.Map <IEnumerable <AuthorGetDto> >(authors))); }
public ActionResult <IEnumerable <AuthorDto> > GetAuthors([FromQuery] AuthorsResourceParameters resourceParameters) { var authorsFromRepo = _courseLibraryRepository.GetAuthors(resourceParameters); return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo))); }
public IActionResult GetAuthors() // This is called an 'action method'. { var authorsFromRepo = _courseLibraryRepository.GetAuthors(); return(new JsonResult(authorsFromRepo)); // Formats the given result as JSON. }
public IActionResult GetAuthors([FromQuery] AuthorResourceParameters authorResourceParameters, [FromHeader(Name = "Accept")] string mediatype) { if (!MediaTypeHeaderValue.TryParse(mediatype, out MediaTypeHeaderValue parsedMeidaType)) { return(BadRequest()); } var vendorMediaType = (parsedMeidaType.MediaType == "application/vnd.marvin.hateoas+json"); if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(authorResourceParameters.OrderBy)) { return(BadRequest()); } if (!_propertyCheckingService.TypeHasProperties <AuthorDto>(authorResourceParameters.Fields)) { return(BadRequest()); } var authors = _courselibraryRepository.GetAuthors(authorResourceParameters); if (authors is null) { return(NotFound()); } if (vendorMediaType) { var paginationMetaData = new { totalCount = authors.TotalCount, pageSize = authors.PageSize, currentPage = authors.CurrentPage, totalPages = authors.TotalPages //previousPageLink = previousPageLink, //nextPagelink = nextPagelink }; //add metadata to header: Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetaData)); var links = CreateLinkForAuthors(authorResourceParameters, authors.HasNext, authors.HasPrevious); var shapedAuthors = _mapper.Map <IEnumerable <AuthorDto> >(authors).ShapeData(authorResourceParameters.Fields); var shapedAuthorWithLinks = shapedAuthors.Select(author => { var authorAsDictionary = author as IDictionary <string, object>; var authorLinks = CreateLinkForAuthor((Guid)authorAsDictionary["Id"], null); authorAsDictionary.Add("links", authorLinks); return(authorAsDictionary); }); var linkedCollectionResource = new { value = shapedAuthorWithLinks, links }; return(Ok(linkedCollectionResource)); } else { var previousPageLink = authors.HasPrevious ? CreateAuthorsResourceUri(authorResourceParameters, ResourceUriType.PreviousPage) : null; var nextPagelink = authors.HasNext ? CreateAuthorsResourceUri(authorResourceParameters, ResourceUriType.NextPage) : null; var paginationMetaData = new { totalCount = authors.TotalCount, pageSize = authors.PageSize, currentPage = authors.CurrentPage, totalPages = authors.TotalPages, previousPageLink = previousPageLink, nextPagelink = nextPagelink }; //add metadata to header: Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(paginationMetaData)); } return(Ok(_mapper.Map <IEnumerable <AuthorDto> >(authors).ShapeData(authorResourceParameters.Fields))); }
public IEnumerable <AuthorDto> GetAuthors() { var x = _repo.GetAuthors(); return(_mapper.Map <IEnumerable <AuthorDto> >(x)); }
public IActionResult GetAuthors() { var authors = courseLibraryRepository.GetAuthors(); return(new JsonResult(authors)); }
public IActionResult GetAuthors( [FromQuery] AuthorsResourceParams resourceParams, [FromHeader(Name = "Accept")] string mediaType) { if (!MediaTypeHeaderValue.TryParse(mediaType, out var parsedMediaType)) { return(BadRequest()); } if (!mMappingService.IsMappingValid <AuthorDto, Author>(resourceParams.OrderBy)) { return(BadRequest()); } var authors = mRepository.GetAuthors(resourceParams); // var prevPageLink = authors.HasPrevious // ? CreateAuthorsResourceUri(resourceParams, // ResourceUriType.PREVIOUS_PAGE) // : null; // var nextPageLink = authors.HasNext // ? CreateAuthorsResourceUri(resourceParams, // ResourceUriType.NEXT_PAGE) // : null; // var includeLinksPerAuthor = parsedMediaType.SubTypeWithoutSuffix // .EndsWith("hateoas", StringComparison.InvariantCultureIgnoreCase); // IEnumerable<IDictionary<string, object>> authorResourcesToReturn = new List<IDictionary<string, object>>(); // if (includeLinksPerAuthor){ // var primaryMediaType = parsedMediaType.SubTypeWithoutSuffix // .Substring(0, parsedMediaType.SubTypeWithoutSuffix.Length - 8); // // foreach (var author in authors){ // IEnumerable<LinkDto> linksPerAuthor = new List<LinkDto>(); // linksPerAuthor = CreateLinksForAuthor(author.Id, resourceParams.Fields); // // switch (primaryMediaType){ // case "vnd.marvin.author.full":{ // var fullResourceToReturn = mMapper.Map<AuthorFullDto>(author) // .ShapeData(resourceParams.Fields) as IDictionary<string, object>; // fullResourceToReturn.Add("links", linksPerAuthor); // authorResourcesToReturn.Append(fullResourceToReturn); // break; // } // case "vnd.marvin.author.friendly":{ // var fullResourceToReturn = mMapper.Map<AuthorDto>(author) // .ShapeData(resourceParams.Fields) as IDictionary<string, object>; // fullResourceToReturn.Add("links", linksPerAuthor); // authorResourcesToReturn.Append(fullResourceToReturn); // break; // } // } // } // } var pagesMetaData = new { totalCount = authors.TotalCount, pageSize = authors.PageSize, currentPage = authors.CurrentPage, totalPages = authors.TotalPages, // prevPageLink, // nextPageLink }; Response.Headers.Add("X-Pagination", JsonSerializer.Serialize(pagesMetaData)); if (parsedMediaType.MediaType != "application/vnd.marvin.hateoas+json") { return(Ok(mMapper.Map <IEnumerable <AuthorDto> >(authors))); } var links = CreateLinksForAuthors(resourceParams, authors.HasNext, authors.HasPrevious); var shapedAuthorsData = mMapper.Map <IEnumerable <AuthorDto> >(authors) .ShapeData(resourceParams.Fields); var shapedAuthorsDataWithLinks = shapedAuthorsData .Select(author => { var authorAsDictionary = author as IDictionary <string, object>; var authorLinks = CreateLinksForAuthor((Guid)authorAsDictionary["Id"], null); authorAsDictionary.Add("links", authorLinks); return(authorAsDictionary); }); return(Ok(new { authors = shapedAuthorsDataWithLinks, links })); }