// POST api/statements public string Post(SearchObject search, string statementid = null) //[FromBody]dynamic value, string statementid = null) { if (statementid != null) { throw new HttpResponseException(HttpStatusCode.MethodNotAllowed); } if (search != null) { return("foo"); } dynamic value; try { value = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Dynamic.ExpandoObject>(Request.Content.ToString()); }catch { throw new HttpResponseException(HttpStatusCode.BadRequest); } var list = new List <string>(); foreach (dynamic val in value) { var ret = SaveObject(val, null); dynamic njo = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Dynamic.ExpandoObject>(ret); list.Add(njo.id); } return(Newtonsoft.Json.JsonConvert.SerializeObject(list)); }
//[FromBody]dynamic value, string statementid = null) // POST api/statements public string Post(SearchObject search, string statementid = null) { if (statementid != null) { throw new HttpResponseException(HttpStatusCode.MethodNotAllowed); } if (search != null) { return "foo"; } dynamic value; try { value = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Dynamic.ExpandoObject>(Request.Content.ToString()); }catch{ throw new HttpResponseException(HttpStatusCode.BadRequest); } var list = new List<string>(); foreach (dynamic val in value) { var ret = SaveObject(val, null); dynamic njo = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Dynamic.ExpandoObject>(ret); list.Add(njo.id); } return Newtonsoft.Json.JsonConvert.SerializeObject(list); }