Basically, you cannot do this, and the reason is that both methods have the same name and exactly the same signature (same parameter numbers and types), and this will not compile with C #, because C # does not allow of this.
Now, using the web API, if you have two methods with the same action as your example (like GET), and with the same signature (int, User) when you try to hit one of them from the client side ( for example, from Javascript), ASp.NET will try to match the type of parameters passed with methods (actions), and since both have an exact signature, it will fail and will throw an exception due to ambiguity.
So, you either add the ActionName attribute to your methods to distinguish them, or use the Route attribute, and give your methods different routes.
Hope this helps.
source share