title: Pass entire Model."List" to another action in the same controller (from view)
body: <p>I really have no clue on how to do this...</p>
  
  <p>I'm trying to pass my entire Model."List" to another action in my controller.</p>
  
  <p>(The list that I'm trying to pass is the  IEnumerable &lt; Client > Results)</p>
  
  <p>The view model:</p>
  
  <pre><code>public class IndexViewModel
  {
      [DisplayName("Pesquisa")]
      [MinLength(3, ErrorMessageResourceName = "MinLengthErrorMessage", ErrorMessageResourceType = typeof(Messages))]
      public string Query { get; set; }
  
      [DisplayName("Página")]
      public int? Page { get; set; }
  
      [DisplayName("Tamanho da Página")]
      public int? PageSize { get; set; }
  
      [DisplayName("Total de Páginas")]
      public int TotalPages { get; set; }
  
      [DisplayName("Resultados")]
      public IEnumerable&lt;Client&gt; Results { get; set; }
  
      public PagerViewModel ToPagerViewModel()
      {
          return new PagerViewModel()
          {
              Page = this.Page.GetValueOrDefault(1),
              PageSize = this.PageSize.GetValueOrDefault(20),
              TotalPages = this.TotalPages
          };
      }
  }
  </code></pre>
  
  <p>The view</p>
  
  <pre><code>@model EFGEREN.App.Models.ViewModels.Clients.IndexViewModel
  @using System.Linq
  @using System.Web.Mvc
  @using Microsoft.AspNet.Identity
  @using EFGEREN.App.Models.Contexts
  @using EFGEREN.App.Models.Entities
  @using EFGEREN.App.Models.Entities
  @using Resources
  
  @Html.ActionLink("Export lista de emails CSV", "ExportClientsListToCSV", Model.Results)
  
  &lt;table class="table table-striped"&gt;
      &lt;tr&gt;
          &lt;th&gt;@("Código")&lt;/th&gt;
          &lt;th&gt;@("Informações Gerais")&lt;/th&gt;
          &lt;th&gt;@("Endereço")&lt;/th&gt;
          &lt;th&gt;@("Contato")&lt;/th&gt;
          &lt;th&gt;@("Cliente desde")&lt;/th&gt;
          &lt;th&gt;@("Última atividade")&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var item in Model.Results.OrderBy(x =&gt; x.DisplayName))
      {
          &lt;tr&gt;
              //showing my data here... As its a lot of things I just omited it
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is how I populate my viewmodel:</p>
  
  <pre><code>        public ActionResult Index([Bind(Include = "Query,Page,PageSize")] IndexViewModel input)
      {
          var trimmedQuery = (input.Query ?? string.Empty)
              .TrimStart(new[] { ' ', '0', '.', ',' })
              .Trim();
  
          var query = db.Clients as IQueryable&lt;Client&gt;;
  
          if (!string.IsNullOrWhiteSpace(trimmedQuery))
              query = query.Where(client =&gt; (
                  (client.IsDeleted == false) &amp;&amp; (
                      (client.Id.ToString().Contains(trimmedQuery)) ||
                      (!string.IsNullOrEmpty(client.OfficialName) &amp;&amp; client.OfficialName.ToLower().Contains(trimmedQuery)) ||
                      (!string.IsNullOrEmpty(client.DisplayName) &amp;&amp; client.DisplayName.ToLower().Contains(trimmedQuery)) 
                  )
              ));
  
          var currentUserName = User.Identity.GetUserName();
          if (!User.IsInRole("Master") &amp;&amp; !User.IsInRole("Manager"))
              query = query.Where(results =&gt; (results.AssignedToLogin == currentUserName)&amp;&amp;
                                             (results.IsDeleted==false));
  
          var paging = input.ToPagerViewModel();
          var pageIndex = (paging.Page - 1);
          input.TotalPages = query.Count() / paging.PageSize;
          input.Results = query
              .OrderBy(d =&gt; d.DisplayName)
              .Skip(paging.PageSize * pageIndex)
              .Take(paging.PageSize)
              .ToArray();
  
          return View(input);
      }
  </code></pre>
  
  <p>And the actionresult that will receive it:</p>
  
  <pre><code> public void ExportClientsListToCSV(IEnumerable&lt;Client&gt; Results)
      {
      //do something
      }
  </code></pre>
  
  <p>As you can see, I tried using and ActionLink in my view to pass the data, but my action always get a null "Results"...</p>
  
  <p>I'm new to C#, so I may be missing something that may be obvious to you...</p>
  
  <p>I appreciate any help, and thanks in advance.</p>