// PUT api/ideas/5 public IHttpActionResult Put(int id, JObject data) { dynamic json = data; var measure = data.ToObject <Measure>(); measure.ResponsibleSubject = _measureRepository.GetResponsibleSubjectById((int)json.ResponsibleSubjectId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != measure.Id) { return(BadRequest()); } if (!MeasureExists(id)) { return(NotFound()); } _measureRepository.UpdateMeasure(measure); _measureRepository.Save(); return(Ok(measure)); }