title: Issue when filtering Iems by 2 conditions simultaneously in Asp.Net MVC 3 with LINQ To SQL data model
body: <p>My data model consists of 4 tables: Item references Product, Shipping and User. I want to sort Items by Product fields: Category and Condition. In my app I use LINQ To SQL classes. Here is my code:  </p>
  
  <pre><code>public ViewResult Content(string category, string condition, int page = 1)
  {
      var Items = _itemsRepository.GetItems()
                  .Where(i =&gt; category == null &amp;&amp; condition == null || 
                  (i.Product.Category != null &amp;&amp; i.Product.Category == category) ||
                  (i.Product.Condition != null &amp;&amp; i.Product.Condition == condition))
                  .OrderBy(i =&gt; i.ItemId)
                  .Skip((page - 1) * PageSize)
                  .Take(PageSize)
                  .Select(i =&gt; i);
       // return Items to the view
  }
  </code></pre>
  
  <p>The problem also might be caused by routing, so here is the global.asax content:  </p>
  
  <pre><code>        // without categories and conditions
          routes.MapRoute(
              null,
              "Store/Content/Page{page}",
              new { controller = "Store", action = "Content", category = (string)null, condition = (string)null },
              new { page = @"\d+" });
  
          // with conditions
          routes.MapRoute(
              null,
              "Store/Content/{condition}/Page{page}",
              new { controller = "Store", action = "Content", category = (string)null },
              new { page = @"\d+" });
  
          // with categories
          routes.MapRoute(
              null,
              "Store/Content/{category}/Page{page}",
              new { controller = "Store", action = "Content", condition = (string)null },
              new { page = @"\d+" });
  
          // Default route
          routes.MapRoute(
              null,
              "{controller}/{action}",
              new { controller = "Home", action = "Index"});
  </code></pre>
  
  <p>If I put the route with categories above the rout with conditions it can sort by categories and vice versa. How can I sort by categories and conditions simultaneously? Thanks.</p>