How do I specify an object in ASP.NET Web API route decorations? -


i can understand this:

[route("customers/{customerid}/orders/{orderid}")] [responsetype(typeof(ordermodel))] public ihttpactionresult getorderbyid(int customerid, int orderid) 

but how can set route decoration following 3 methods:

// get: api/content public iqueryable<content> get() {     return db.contents; }  // get: api/content/5 [responsetype(typeof(content))] public async task<ihttpactionresult> get(int id) {     content content = await db.contents.findasync(id);     if (content == null)     {         return notfound();     }      return ok(content); }  // put: api/content/5 [responsetype(typeof(void))] public async task<ihttpactionresult> put(int id, content content) {     if (!modelstate.isvalid)     {         return badrequest(modelstate);     } } 

i cannot find examples of there no input parameters or input parameters contain objects json serialized in example working before tried user route decoration.

not sure understand you're trying do, this attribute routing explanation might help.


Comments

Popular posts from this blog

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

php - facebook and github login HWIOAuthBundle and FOSUserBundle in Symfony2.1 -

hadoop - Sqoop installation export and import from postgresql -