In my DOT NET CORE MVC application i am using Url Action
inside a view to generate and redirect action link
@Url.Action ("Action Name","Controller Name")
Above synatax is working fine for me where i am passing static value of controller like
'@Url.Action(nameof(EmployeeController.Edit),"Employee")'
Here controller name is static and i want to avoid a situation like in future if i change controller name at that time i need to remember this changes in view so my requirement is Basically i want to pass controller name like below
'@Url.Action(nameof(EmployeeController.Edit),nameof(EmployeeController))'
Controller and Action method is
public class EmployeeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult Edit()
{
return RedirectToAction("Index", "HotelList", new { area = "Hotel" });
}
}
Suggest me best way to do this
Thanks in advance