public ActionResult EditName(EditNameViewModel model) { if (ModelState.IsValid) { ApplicationUser user = UserManager.FindById(model.UserId); user.Name = model.Name; UserManager.Update(user); return RedirectToAction("Index"); } return View(model); }
public ActionResult EditName(string userid) { EditNameViewModel model = new EditNameViewModel { UserId = userid, Name = UserManager.FindByIdAsync(userid).Result.Name }; return View(model); }