title: Better approach to role-based UI changes?
body: <p>I have an MVC view that changes a few small UI elements based on the user's role.  Currently it modifies the output using a few if() statements using a couple boolean values I sent to the view through the viewmodel.  However, it doesn't seem like a very good approach, so what I'd like to do is move this all into either an HtmlHelper class or the controller itself.  Here's the current code:</p>
  
  <pre><code>&lt;% if ( Model.IsAdmin ) { %&gt; &lt;td&gt; &lt;% } %&gt;  &lt;%--Opening tag for admin options--%&gt;
  &lt;% if ( Model.IsAdmin ) { %&gt; &lt;%:Html.ActionLink("Delete", "Delete", new { id = Id})%&gt; &lt;% } %&gt; &lt;%--Admin options--%&gt;
  &lt;% if ( Model.IsAdmin ) { %&gt; &lt;/td&gt; &lt;% } %&gt; &lt;%--Closing tag for admin options--%&gt;
  </code></pre>
  
  <p>There's a seperate spot where I show/hide the create new link as well</p>
  
  <pre><code>&lt;% if ( Model.IsEditor || Model.IsAdmin ) { %&gt;
      &lt;%:Html.ActionLink("Create New", "Create") %&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>There might be a couple other of these situations as well.</p>
  
  <p>So any HtmlHelper I would build would potentially need a couple overloads for the different cases, so it would probably need to be pretty flexible.  I've just been going around and around in my head on the best approach to this, and it seems like a common problem that someone else would probably have come up with already...</p>
  
  <p>Thanks!</p>