Ejemplo n.º 1
0
        public ActionResult ProfileSave(User user)
        {
            if (string.IsNullOrEmpty(user.Email))
            {
                ModelState.AddModelError("Email", "You must provide an email address");
            }

            if (!ModelState.IsValid)
            {
                return(View("Profile", user));
            }

            User cuser = CurrentUserModel.GetUser(user.Id);

            cuser.Name  = user.Name;
            cuser.Email = user.Email;
            CurrentUserModel.UpdateUser(cuser);

            return(RedirectToAction("Index", "Home"));
        }