title: Distinct with group by in Linq
body: <pre><code>ID  UserName    BookType    BookID
  
  1   Krish       1           1
  1   Krish       1           2
  1   Krish       2           1
  1   Krish       2           2
  2   Ram         1           1    
  3   Raj         1           1
  3   Raj         1           2
  </code></pre>
  
  <p>I have above table and I want to get the distinct BookType count and BookID count for each user, I am able to write this in SQL Server but when I come to LINQ I am unable to write the query.</p>
  
  <p><strong>I need the following output</strong></p>
  
  <pre><code>ID  UserName    BookType    BookID
  
  1   Krish       2           2
  2   Ram         1           1 
  3   Raj         1           2
  </code></pre>