// GET api/verbs/5 public IHttpActionResult Get([FromUri] int id) { var a = new Toto() { Hello = "World", Id = id }; // When returning object, ASP.NET chooses automatically the Formatter (serializer) // The formatter depends on Request Accept Header and returned payload type (serializable or not ?) return(Ok(a /*, Configuration.Formatters.JsonFormatter*/)); }
// PUT api/verbs/5 public IHttpActionResult Put(int id, [FromBody] Toto value) { return(Ok(("PUT", id, value))); }
// POST api/verbs public IHttpActionResult Post([FromBody] Toto value) { return(Ok(("POST", value))); }