How to index view record information only current user

Hi,

i have already code  in index view recorded only information about current user . My code is below:

 var req = db.permit.Include(e => e.User).Where(m => m.UserId == User.Identity.GetUserId());
        return View(req);
But it's not work. can anyone give me a solution.

Thank  you.
Last updated:3/18/2016 12:45:55 AM

1 Answers

Sachin Singh
Sachin Singh

Hi Anupam,


If you are use this code, i think your problem probably be solved:

string userID = User.Identity.GetUserId();
var req = db.permit.Include(e => e.User).Where(m => m.UserId == userID);
return View(req);

Answer