title: MVC3 Pass additional data from ctrl to view
body: <p>If I were to pass additional data (other than the model) into my view, like say a list of files from a specific folder, whats the best way to do that? </p>
  
  <p>I was thinking something like making a method and return a list into <code>ViewData</code>:</p>
  
  <pre><code>        public List&lt;string&gt; GetFiles(int id, string cat)
      {
          var files = new List&lt;string&gt;();
  
          var folder = "~/App_Data/uploads/" + cat + "/" + id.ToString();
          foreach (var file in Directory.GetFiles(folder))
          {
              files.Add(file);
          }
          return files;
      }
  </code></pre>
  
  <p>The controller:</p>
  
  <pre><code>ViewData["files"] = db.GetFiles(id, "random");
  </code></pre>
  
  <p>The view:</p>
  
  <pre><code>@foreach (var item in ViewData["files"]){ //markup }
  </code></pre>
  
  <p>First, ive heard that viewdata and viewbag shouldnt be used. Second, this code doesnt work. Something with Viewdata object is not enumerable. Should I make a model class for these files. If so, how? 2 models in one view? Im a bit confused how to do this proberly.</p>