title: How to implement sort function in ASP.NET MVC
body: <p>Now I am creating application using <a href="http://www.asp.net/mvc/tutorials/mvc-music-store" rel="nofollow noreferrer">MVC Music Store tutorial</a>. I want to implement sort function. I got stuck in implementation of Post Browse action.</p>
  
  <p><img src="https://i.stack.imgur.com/zlXqh.jpg" alt="enter image description here"></p>
  
  <p>Browse.cshtml</p>
  
  <pre><code>@model Overstock.Models.Category
  
  @{
      ViewBag.Title = "Browse Albums";
  }
  
  &lt;div class="product"&gt;
      &lt;h3&gt;&lt;em&gt;@Model.Name&lt;/em&gt; Products&lt;/h3&gt;
  
  
  &lt;form action="/Store/Browse" method="POST"&gt;
      Sort 
      &lt;select id="Category" name="Category"&gt;
      &lt;option value="All"&gt;All&lt;/option&gt;
      &lt;option value="Electronics"&gt;Electronics&lt;/option&gt;
      &lt;option value="Sports"&gt;Sports&lt;/option&gt;
      &lt;option value="Watches"&gt;Watches&lt;/option&gt;
      &lt;option value="Office"&gt;Office&lt;/option&gt;
      &lt;option value="Beauty"&gt;Beauty&lt;/option&gt;
      &lt;/select&gt;
      products by
      &lt;select id="SortType" name="SortType"&gt;
      &lt;option selected="selected" value="Name"&gt;Name&lt;/option&gt;
      &lt;option value="Price"&gt;Price&lt;/option&gt;
      &lt;/select&gt;
      in
      &lt;select id="OrderBy" name="OrderBy"&gt;
      &lt;option selected="selected" value="Ascending"&gt;Ascending&lt;/option&gt;
      &lt;option value="Descending"&gt;Descending&lt;/option&gt;
      &lt;/select&gt;
      order
      &lt;input type="submit" value="Set" /&gt;
  &lt;/form&gt;
  
      &lt;ul id="product-list"&gt;
          @foreach (var product in Model.Products)
          {
              &lt;li id="product"&gt;
                  &lt;a href="@Url.Action("Details", new { id = product.ProductId })"&gt;
                      &lt;img id="image" alt="@product.Title" src="@product.PictureUrl" /&gt;
                      &lt;span&gt;@product.Title&lt;/span&gt;
                  &lt;/a&gt;
              &lt;/li&gt;
          }
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>StoreController.cs</strong></p>
  
  <pre><code>   // GET: /Store/Browse
          public ActionResult Browse(string category)
          {
              var varCategory = MyDB.Categories.Include("Products").Single(c=&gt; c.Name==category);
              return View(varCategory);
          }
  
          [HttpPost]
          public ActionResult Browse(string Category, string SortType, string OrderBy)
          {
              //What should I put here?
              return View();
          }
  </code></pre>
  
  <p>What should I write in Browse Post action? Please help.</p>