MVC HTML.Actionlink to route to different controller action
Posted on 2011-03-24
What is the best approach to route the following to a controller action from anywhere with an MVC app? The following code is everywhere in the app and I need to make it a link so that it routes back to a user details page. I have two areas in the app SuperAdmin and TeamAdmin and I want to redirect back to the SuperAdmin edit user page if in SuperAdmin area and route back to the TeamAdmin area if in TeamAdmin. I guess I may need to replicate a bit of edit user functionality as they both do different things.
So this needs amending so if clicked on it goes to the users controller "details" action passing the userID
<%= Html.Encode(Model.OriginatingUser.FirstName + ", " + Model.OriginatingUser.Surname) %>