コード例 #1
0
        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);
        }
コード例 #2
0
        public ActionResult EditName(string userid)
        {
            EditNameViewModel model = new EditNameViewModel
            {
                UserId = userid,
                Name = UserManager.FindByIdAsync(userid).Result.Name
            };

            return View(model);
        }