title: How to group product by category on list view by LinQ?
body: <p>I'm a newbiew asp.net mvc !</p>
  
  <p>I'm having a list view to display Products:</p>
  
  <pre><code>Id  CateId CateName
  1   2      Cate-B
  |__ Product-B  
  2   1      Cate-A
  |__ Product-A
  3   1      Cate-A
  |__ Product-C   
  </code></pre>
  
  <p>but now I want to display a list view group product by category like below. How can I do it ?</p>
  
  <pre><code>Id  CateId CateName
  1   2      Cate-B
  |__ Product-B
  2   1      Cate-A
  |__ Product-B
  |__ Product-C
  </code></pre>
  
  <p>this is my code:</p>
  
  <pre><code>        public IQueryable&lt;MyGroup&gt; GetAllProduct()
      {
          var query = (from c in _categoryRepository.Table()
                       join p in _productRepository.Table() on c.Id equals p.CateId
                       select new MyGroup
                       {
                           Categories= c,
                           Products = p
  
                       }).ToList();
  
          return query.AsQueryable();
      }
  </code></pre>