Actually it is possible to implement what you are asking. It is necessary to use the route constraints.
For example, the following two action method will be called with the same action name Method
depend on the data
parameter type: the first when data
is int
, and the second when the data
parameter is bool
.
[HttpPost, Route("{data:int}")]
public IActionResult Method(int data)
{
return RedirectToAction("Method1", data);
}
[HttpPost, Route("{data:bool}")]
public IActionResult Method(bool data)
{
return RedirectToAction("Method2", data);
}
In your case the Custom route constraints should be implemented to use this feature: one class to support DOBMatchRequest
type, and the second class for List<DOBMatchRequest>
type.
For more information see:
Route constraints
Custom route constraints
Note: Yes... this is more likely overloading
, not overriding
.