This is because in C # it is forbidden to have two methods with the same parameter names and types. This has nothing to do with ASP.NET MVC. You must rename one of the two Add actions that can be invoked by GET.
You cannot have two action names with the same name that can be invoked using the same verb (in your case, GET). You need to either rename one of them, or use a different HTTP verb, as with the POST action.
UPDATE:
You can try to enter an HTTP verb into the attribute of a custom action:
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) { return controllerContext.HttpContext.Request[ValueName] != null && controllerContext.HttpContext.Request.HttpMethod == "GET"; }
but honestly, I would not use a special action selector to check for the presence or absence of a query parameter. Route restrictions or data annotations seem much more appropriate for this task.
source share