我有这个返回0的代码
var currentUser = User.Identity.GetUserId();
var businesses = db.Businesses.Where(num => num.BusinessEmail == currentUser);
ViewBag.CurrCount = businesses.Count();
此代码返回7
var businesses = db.Businesses.Where(num => num.BusinessEmail == "myname@mysite.com");
ViewBag.CurrCount = businesses.Count();
myname@mysite.com 是User.Identity.GetUserId();
有什么想法吗?
答案 0 :(得分:1)
var currentUser = User.Identity.Name;
昨晚我有点累了!