title: Using tempdata as a error model
body: <p>I use TempData for user messages.  </p>
  
  <p>When I try to do this, it tells me TempData does not exist in the current context.</p>
  
  <pre><code>public class ServerMessage
  {
      public void appendAlertMessage(string message, ServerMessageClass messageClass)
      {
          if(TempData["alertMessage"] == null) 
              TempData["alertMessage"] = message;
          else 
              TempData["alertMessage"] += "\n" + message;
  
          if(TempData["alertClass"] != ServerMessageClass.Error)
              TempData["alertClass"] = messageClass;
  
      }
  }
  
  public class ServerMessageClass
  {
      public const string Success = "success";
      public const string Warning = "warning";
      public const string Error = "error";
  }
  </code></pre>
  
  <p>Is there an alternative way to do this?</p>