RAZOR

namespace MVCOverloadedActions.Controllers {
    public class CustomerController: Controller {

        public ActionResult GetCustomer()
        {
            return Content("This is original simple Action");
        }

        [ActionName("GetCustomerByCode")]
        public ActionResult GetCustomer(string CustomerCode)
        {
            return Content("This is overloaded Action");
        }


    }
}

the URL: /Customer/GetCustomer would output content from first method i.e. "This is original simple Action"

the URL: /Customer/GetCustomerByCode would output content from first method i.e. "This is overloaded Action"

Last updated

Was this helpful?