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
Post a Comment