Bojangles
Bojangles

Reputation: 467

Working with User.Identity.GetUserId()

I have this code that returns 0

var currentUser = User.Identity.GetUserId();
var businesses = db.Businesses.Where(num => num.BusinessEmail == currentUser);

ViewBag.CurrCount = businesses.Count();

And this code that returns 7

var businesses = db.Businesses.Where(num => num.BusinessEmail == "[email protected]");

ViewBag.CurrCount = businesses.Count();

[email protected] is User.Identity.GetUserId();

Any ideas?

Upvotes: 0

Views: 78

Answers (1)

Bojangles
Bojangles

Reputation: 467

var currentUser = User.Identity.Name;

I was a little tired last night!

Upvotes: 1

Related Questions