public IActionResult GetTastingNote(int brewId, int id, [FromHeader(Name = ExtendedControllerBase.ACCEPT)] string mediaTypes) { var splitMediaTypes = mediaTypes.Split(','); if (!MediaTypeHeaderValue.TryParseList(splitMediaTypes, out IList <MediaTypeHeaderValue> parsedMediaTypes)) { return(BadRequest()); } if (!_homebrewRepository.BrewExists(brewId)) { return(NotFound()); } var tastingNote = _homebrewRepository.GetTastingNote(brewId, id); if (tastingNote == null) { return(NotFound()); } if (parsedMediaTypes.Any(pmt => pmt.SubTypeWithoutSuffix.EndsWith(this.HATEOAS, StringComparison.InvariantCultureIgnoreCase))) { var links = CreateLinksForTastingNote(brewId, id); var linkedResourcesToReturn = _mapper.Map <TastingNoteDto>(tastingNote).ShapeData(null) as IDictionary <string, object>; linkedResourcesToReturn.Add(this.LINKS, links); return(Ok(linkedResourcesToReturn)); } return(Ok(_mapper.Map <TastingNoteDto>(tastingNote).ShapeData(null))); }