title: send model with ajax to controller, asp.net mvc
body: <p>I wondering what is the best way to accomplish this task:
  In my index method I'm either searching or filtering or just taking
  data from my db. Then I send n items to view. If there more than n items
  I need some paging to be done. As I understand I can query my db again
  filter or search and take next n elements or I can somehow persist all
  my data(filtered or data received after search query) and just
  take n next elements from it. As I understand session is not the best way
  to accomplish it, so instead of IEnumerable of this class</p>
  
  <pre><code>public class CatalogModel
  {
      public string Price;
      public string deviceName;
      public string imgUrl;
  } 
  </code></pre>
  
  <p>I've decided to use this class</p>
  
  <pre><code>public class CatalogView
  {
      public IEnumerable&lt;CatalogModel&gt; Catalog;
      public IEnumerable&lt;Device&gt; Devices;
  
      public CatalogView(IEnumerable&lt;CatalogModel&gt; catalog = null, IEnumerable&lt;Device&gt; devices = null)
      {
          Catalog = catalog;
          Devices = devices;
      }
  }
  </code></pre>
  
  <p>I wand to keep all my data in </p>
  
  <pre><code> public IEnumerable&lt;Device&gt; Devices 
  </code></pre>
  
  <p>this field and each time send it to controller,
  but I don't know how can I access it from javascript so I can post it back 
  with ajax. </p>
  
  <p>Is it possible to do it such way and will it be more efficient than
  querying each time my db.</p>
  
  <p>Thank you!</p>