Пример #1
0
        public ActionResult EditProfile(EditProfileViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var user = db.Users.Find(User.Identity.GetUserId());
            user.FirstName = model.FirstName;
            user.LastName = model.LastName;
            user.Email = model.Email;
            user.UserName = model.Email;
            
            db.SaveChanges();

            return RedirectToAction("Index", new { Message = ManageMessageId.EditProfileSuccess });
        }
Пример #2
0
        public ActionResult EditProfile()
        {
            var name = new EditProfileViewModel();
            var user = db.Users.Find(User.Identity.GetUserId());
            
            name.FirstName = user.FirstName;
            name.LastName = user.LastName;
            name.Email = user.Email;

            return View(name);
        }