Tutorial by Examples

Simply add an attribute to the controller action [Route("product/{productId}/customer")] public IQueryable<Product> GetProductsByCustomer(int productId) { //action code goes here } this will be queried as /product/1/customer and productId=1 will be sent to the controll...
In cases where you need a common portion of the route for all routes within a controller, RoutePrefix attribute is used. In the below example, api/students part of the code is common and so we can define RoutePrefix and avoid using it repeatedly. [RoutePrefix("api/students")] public cla...

Page 1 of 1