title: How to map 2 diffrent List in asp.net MVC
body: <p>I was trying to send a list from Controller to View. I thought it would bind, but it's a different type so it won't. <em>(error: Argument type 'System.Collections.Generic.List' is not assignable to model type 'System.Collections.Generic.IEnumerable')</em>. So how am I supposed to map both list?</p>
  
  <p>Controller</p>
  
  <pre><code> public ActionResult MyData()
      {
          var oldList = db.oldList.Select(x=&gt;x.Name).ToList();
  
  // probably here i should add var newList and in some way map with oldList then return to view
  
          return View(oldList);
      }
  </code></pre>
  
  <p>New list ViewModel</p>
  
  <pre><code> public class NewListViewModel
      {
          public string Name { get; set; }
          public int Count { get; set; }
      }
  </code></pre>
  
  <p>My View (MyData)</p>
  
  <pre><code>@model IEnumerable&lt;MyApp.ViewModels.NewListViewModel&gt;
  
  &lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Name)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Count)
          &lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var item in Model)
      {
          using (Html.BeginForm())
          {
              &lt;tr&gt;
                  &lt;td&gt;
                      @Html.TextBoxFor(modelItem =&gt; item.Name)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.TextBoxFor(modelItem =&gt; item.Count)
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      }
  &lt;/table&gt;
  </code></pre>