Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
228 Points
55 Posts
Apr 27, 2012 07:39 PM|LINK
Routing is now a global concept. ASP.NET (MVC and Web API) assumes that you will use a global or controller level convention to define your routes.
Having said that, nothing stops you to define this route in your API:
config.Routes.MapHttpRoute( name: "mySpecialRoute", routeTemplate: "api/placement/{id}", defaults: new { id = RouteParameter.Optional, controller = "placement"
});
And your controller having an action
public IEnumerable<MyType> Get(int id, [FromUri]int take, [FromUri]int skip) { ... }
aliostad
Member
228 Points
55 Posts
Re: Couple things I don't get :/
Apr 27, 2012 07:39 PM|LINK
Routing is now a global concept. ASP.NET (MVC and Web API) assumes that you will use a global or controller level convention to define your routes.
Having said that, nothing stops you to define this route in your API:
config.Routes.MapHttpRoute( name: "mySpecialRoute", routeTemplate: "api/placement/{id}", defaults: new { id = RouteParameter.Optional, controller = "placement"And your controller having an action
public IEnumerable<MyType> Get(int id, [FromUri]int take, [FromUri]int skip) { ... }