public ActionResult UpdateWaterProfile(int id, [FromBody] WaterProfileForUpdateDto waterProfile, [FromHeader(Name = ExtendedControllerBase.ACCEPT)] string mediaTypes) { var splitMediaTypes = mediaTypes.Split(','); if (!MediaTypeHeaderValue.TryParseList(splitMediaTypes, out IList <MediaTypeHeaderValue> parsedMediaTypes)) { return(BadRequest()); } var includeAdditions = true; var waterProfileEntity = _homeBrewRepository.GetWaterProfile(id, includeAdditions); if (waterProfileEntity == null) { return(NotFound()); } _mapper.Map(waterProfile, waterProfileEntity); _homeBrewRepository.UpdateWaterProfile(waterProfileEntity); _homeBrewRepository.Save(); if (parsedMediaTypes.Any(pmt => pmt.SubTypeWithoutSuffix.EndsWith(this.HATEOAS, StringComparison.InvariantCultureIgnoreCase))) { var links = CreateLinksForWaterProfile(waterProfileEntity.Id, includeAdditions); var waterProfileToReturn = _mapper.Map <WaterProfileDto>(waterProfileEntity); var linkedResourceToReturn = waterProfileToReturn.ShapeData(null) as IDictionary <string, object>; linkedResourceToReturn.Add(this.LINKS, links); return(Ok(linkedResourceToReturn)); } return(NoContent()); }