Reputation: 171
I am looking for a way to override action call if some action is present in the controller.
Imagine :
[Route("api/[controller]")]
public partial class UsersController : BaseController {
[HttpGet("Friends/{id}")]
public IActionResult GetFriends(int id) {
// some code
}
then I have in an other file :
[Route("api/[controller]")]
public partial class UsersController : BaseController {
[HttpGet("Friends_custom/{id}")]
public IActionResult GetFriends_custom(int id) {
// some code
}
I want my frontend to only call
/users/friends
How can I get asp route to match the _custom if it exist?
Upvotes: 2
Views: 4635
Reputation: 171
After a long day, I found out we can use Order in the RouteAttribute. it does exactly what I need!
Upvotes: 6