ASP.NET MVC 5 + ASP.NET Identity Framework 2.0 – Customized User Account Attribute ( Read Customized Account Attribute )
1. Update "Account Management – Index" View to show the Customized Account Attribute form the File "\Manage\Index.cshtml".
2. Update "Manage" Controller – "Index" Method from the File "\Controllers\ManageController.cs" as follow.
public async Task<ActionResult> Index(ManageMessageId? message) { … … var userId = User.Identity.GetUserId(); 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), UserID = await UserManager.GetEmailAsync(userId) }; model.PostTitle = UserManager.FindById(userId).PostTitle; return View(model); } |