tri_inn

tri_inn

  • NA
  • 1.2k
  • 233k

Web API: Need to understand a web api attribute routing

Apr 25 2017 9:31 AM
got the code from this url http://stackoverflow.com/questions/21704505/how-do-i-use-webapi-rest-correctly-when-other-params-are-needed?rq=1
 
i am new in web api attribute routing
  1. [Route("customers/{customerId}/orders")]  
  2. public IEnumerable<Order> GetOrdersByCustomer(int customerId) { ... }  
  3.   
  4. or  
  5.   
  6. [Route("customers/{customerId}/orders/{orderId}")]  
  7. public Order GetOrderByCustomer(int customerId, int orderId) { ... } 
 what is the meaning of 1st and 2nd route ?
 
how the first and second url will look like  please add the same url for both above action ?
 
thanks

Answers (1)