title: return a model with .Include to view
body: <p>I have the following item model:</p>
  
  <pre><code>public class Item
  
   {
     public int Id {get; set;}
     public string name {get; set;}
     public virtual ICollection&lt;Comment&gt; Comments {get; set;}
     public virtual Comment Comment {get; set;}
   }
  </code></pre>
  
  <p>I have the following User model:</p>
  
  <pre><code>public class User
  
   {
     public int Id {get; set;}
     public string UserName {get; set;}
     public string email {get; set;}
   }
  </code></pre>
  
  <p>And I have the following Comment model:</p>
  
  <pre><code>public class Comment
  
   {
     public int Id {get; set;}
     public string text {get; set;}
     public DateTime DateCreated {get; set;}
  
     public int ItemId {get; set;}
     [ForeignKey("ItemId")]
     public virtual Item Item {get; set;}
  
     public int UserId {get; set;}
     [ForeignKey("UserId")]
     public virtual User User {get; set;}
   }
  </code></pre>
  
  <p>In my onModelCreating Context I have</p>
  
  <pre><code> modelBuilder.Enitity&lt;Item&gt;().HasOptional(c=&gt;c.Comment).WithMany();
  </code></pre>
  
  <p>My aim is to return to a view the items which only the requesting user has commented on.</p>
  
  <p>So far I have done:</p>
  
  <pre><code> int UserId = db.Users.Where(u=&gt;u.UserName.Equals(User.Identity.Name))
   .Select(u=&gt;u.Id).FirstOrDefault();
  
  
   var itemsWithComments = db.Items.Include(c=&gt;c.Comments).......
  </code></pre>
  
  <p>At this point I want to be able to say: Select the items which the UserId == Comments.UserId, return the Items as a list.</p>
  
  <p>And my View (using Razor)</p>
  
  <pre><code> @model IEnumerable &lt;project.Models,Item&gt;
  
   @foreach (var item in Model)
   .....
   .....
  </code></pre>
  
  <p>Any help is much appreciated.</p>
  
  <p>If you need me to clarify any point(s) please ask.</p>
  
  <p>Kind regards                 </p>