【发布时间】:2016-04-22 13:32:03
【问题描述】:
所以我有一个 ASP.NET MVC 5 应用程序。登录后,您可以单击“您好!”的链接。并且可以看到Manage View,这是模板制作的默认页面,使用IndexViewModel。
我通过添加成功使其显示用户的电子邮件
public string Email { get; set; }
在 IndexViewModel 中,然后在 ManageController 中
var model = new IndexViewModel
{
HasPassword = HasPassword(),
PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
Logins = await UserManager.GetLoginsAsync(userId),
BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId),
Email = await UserManager.GetEmailAsync(userId)
};
但这很简单,因为 UserManager 已经有一个名为 GetEmailAsync 的任务。我怎样才能像这样从数据库中检索数据,但对于我添加的其余字段? (用户由 RegisterStudentViewModel 创建) 我试图创建另一个任务,但它没有工作。我将如何解决这个问题?我希望他们能够看到他们的详细信息,甚至可以对其进行编辑(例如更改已经存在的电话号码)
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-identity