Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public ActionResult Index() {
  2. // IsUserAnEditor is a placeholder for a method to determine whether the user
  3. // is an editor based on whatever role technology you're using.
  4. MyModel model = new MyModel { IsEditor = IsUserAnEditor() }
  5. return View(model);
  6. }
  7.  
  8. @model MyModel
  9.  
  10. ....
  11.  
  12. @if(Model.IsEditor)
  13. {
  14. // Code to add the "Edit" link, this is just an example, customize for your needs
  15. <span>
  16. @Html.ActionLink("Edit", "Edit", "MyController", new { id=Model.ID })
  17. </span>
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement