如何将 AspNetUsers 加入我的表,其中电子邮件已从 AspNetUsers 表确认
从表中选择用户 AspNet用户,其中电子邮件已确认
var context = new IdentityDbContext();
var users = context.Users.Where(d => d.EmailConfirmed == true).Select(d => d.Id).ToList();
我的桌子
ApplicationDbContext db = new ApplicationDbContext();
UserAccountListViewModel model = new UserAccountListViewModel();
model.UserAccounts = db.UserAccounts.ToList();
您可以执行以下操作:
UserAccountListViewModel model = new UserAccountListViewModel();
model.UserAccounts = db.UserAccounts.Where(ua => users.Contains(ua.Id)).ToList(); // Here `ua.Id` is the column of `UserAccount` table that you are comparing against the Id of Users table.