I'm trying to list every comments created by the the specific user (Users Id stored in Session["LoggedUserID"]) but I'm having hard time solving the lambda expression as I basically never done it before.
The following code is faulty, but this about what I had in mind.
public ActionResult MyComments(Guid? id)
{
id = new Guid(Session["LoggedUserID"].ToString());
var comments = db.Comments.Include(m=> m.CreatorUserId.Equals(id));
return View(comments.ToList());
}
Addintional info:
Database-first
Using Guids for Id's.
Any help is much appreciated.
Includeinstead ofWhere, include should be used when you want to expand an entity inside your comments, ex: the user CreatorUser