title: Enabling Users to Edit Custom Account Settings in MVC
body: <p>From the bare-bones MVC project template, I've extended <code>ApplicationUser.cs</code> to display a new user account setting called <code>DisplayName</code> (its a display name that people will use in a chat application as part of the site):</p>
  
  <pre><code>public string DisplayName { get; set; }
  </code></pre>
  
  <p>I have modified the bare-bones MVC project template so that I can register a new account and specify the DisplayName, and I can even see it in my database, so all is good (the process is described <a href="http://go.microsoft.com/fwlink/?LinkID=317594" rel="nofollow">here</a>). Anyhow, <strong>the problem</strong> I am facing now is that I want to allow the user to change this setting, so I have extended the account management page to show an HTML partial page with a text field that displays this setting. When they post this partial page, this action is called:</p>
  
  <pre><code>// POST: /Account/Manage
  [HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; ManagePublicSettings(ManagePublicSettingsViewModel model)
  {
      ViewBag.ReturnUrl = Url.Action("Manage");
      if (ModelState.IsValid)
      {
          IdentityResult result = await UserManager.ChangeDisplayName(User.Identity.GetUserId(), model.DisplayName);
          if (result.Succeeded)
          {
              var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
              return RedirectToAction("Manage", new { Message = ManageMessageId.ChangeAccountSettingsSuccess });
          }
          else
          {
              AddErrors(result);
          }
      }
      // If we got this far, something failed, redisplay form
      return View(model);
  }
  </code></pre>
  
  <p>What should <code>ChangeDisplayName</code> (called by this method) look like? And is this the correct way to extend the account management portal in MVC? Should I extend the <code>ApplicationUserManager</code> class like this? I am fairly new to MVC, and just want to get it right.</p>