I have an ASP.Net MVC 3 application. With 2 areas:
- Auth - handles all authentication, etc.
- Management - Real Estate Management
In the management area, I have ManagementController and PropertyController. ManagementController does nothing, it has a simple ActionResult pointer, which returns a view.
The PropertyController has an ActionResult pointer, which returns a view with a list of properties, as well as an Edit ActionResult, which takes propertyId as. In the property index view, I have a grid with a list of properties and the ability to change a property with the following code:
@Html.ActionLink("Edit", "Edit","Property", new { id = item.PropertyId })
In theory, this should be redirected to the Edit ActionResult of my property controller, however it will redirect to the Index ActionResult of my ManagementController. My ManagementAreaRegistration file looks like this:
context.MapRoute(null, "management", new { controller = "management", action = "Index" });
context.MapRoute(null, "management/properties", new { controller = "Property", action = "Index" });
context.MapRoute(null, "management/properties/Edit/{propertyId}", new { controller = "Property", action = "Edit" });
And my global.asax RegisterRoutes:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
What am I missing, why is it redirecting to the wrong controller and action? Thanks at Advance!