title: Lambda function to color code certain values in mvc3 view?
body: <p>I have the following code within a razor mvc3 view that is duplicated in a couple of grids and tables to color code values:</p>
  
  <pre><code>        @{var val= @@item.value * 100);}
          @if(@val &lt; 85) { &lt;div style='color: #C11B17' &gt; @val.ToString("0.0")%&lt;/div&gt; }         
          @if(@val &gt;= 85 &amp;&amp; osi &lt;=95 ) { &lt;div style='color: #AF7817' &gt; @val.ToString("#.0")%&lt;/div&gt; }         
          @if(@val &gt; 95 &amp;&amp; osi &lt;=115) { &lt;div style='color: green' &gt; @val.ToString("#.0")%&lt;/div&gt; }                  
          @if(@val &gt; 115) { &lt;div style='color: blue' &gt; @val.ToString("#.0")%&lt;/div&gt; }    
  </code></pre>
  
  <p>How can I re-write to an equivalent lambda function so I can reuse within my view?</p>