How to put two actions in the controller with the same name and same parameter type?

Is is possible to put two actions in the controller with the same name and same no. of parameters and parameter type as shown below.

 [HttpGet] public ActionResult Index(int x) { return View(); } [HttpPost] public ActionResult Index(int a) { return View(); }
By in on Apr 07 2020
• Aug, 2020 3

• 0
• Jul, 2020 21

Yes because you are using different verbs Get and Post, if you wanted two gets or two posts you could change the route

• 0
• Jul, 2020 21

Yes because you are using different verbs Get and Post, if you wanted two gets or two posts you could change the route

• 0