Пример #1
0
        public ActionResult MyAccount(MyAccountModel model)
        {
            if (!ModelState.IsValid) return View("MyAccount", model);

            SubjectManager subjectManager = new SubjectManager();

            User user = subjectManager.GetUserById(model.UserId);

            if (model.Password == model.ConfirmPassword && model.Password != null)
            {
                subjectManager.ChangePassword(user.Id, model.Password);
            }

            if (model.SecurityAnswer != null)
            {
                subjectManager.ChangeSecurityQuestionAndSecurityAnswer(user.Id, model.SecurityQuestionId, model.SecurityAnswer);
            }

            user.Email = model.Email;
            user.FullName = model.FullName;

            subjectManager.UpdateUser(user);

            return RedirectToAction("Index", "Home", new { area = "" });
        }