I have a simple route in my project:
routes.MapRoute(
name: "api",
template: "api/{controller}/{action}");
In my controller, I have two actions:
[HttpGet]
public string Get(string value)
{
return value;
}
[HttpGet]
public string Get(int id)
{
return id.ToString();
}
Now, when I try to make the url like api/controller/get?id=1, this will not work, because the structure cannot distinguish between the two actions. As far as I remember, this worked very well in a regular web api, because it is obvious that this URL matches only one of the actions based on this parameter. Did I do something wrong or didn't support in the new MVC6?
source
share