When a user logs in i want them to see only db entry that match there id on the index page
im currently using the below which works as fare as getting the correct data but get a error when i run the project
Code:
public ActionResult Index()
{
return View(db.UserProfiles.ToList().Where(u => u.UserId ==
(int)Membership.GetUser().ProviderUserKey));
}
Error: nullreferenceexception was unhandled by the user code Object reference not set to an instance of an object.