public ActionResult Create(User user, string confirmPassword)
        {
            AccountController.ValidateRegistration(user.Login, user.Password, confirmPassword,
                                                   ModelState, membershipService, UserRepository);

            if (ViewData.ModelState.IsValid && user.IsValid())
            {
                user.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(user.Password, "SHA1");
                UserRepository.SaveOrUpdate(user);

                Message = "Пользователь успешно создан.";
                return this.RedirectToAction(c => c.Index());
            }

            return View(user);
        }
        public ActionResult Edit(User user)
        {
            User userToUpdate = UserRepository.Get(user.Id);
            TransferFormValuesTo(userToUpdate, user);

            if (ViewData.ModelState.IsValid && user.IsValid())
            {
                Message = "Изменения успешно сохранены.";
                return this.RedirectToAction(c => c.Index());
            }
            UserRepository.DbContext.RollbackTransaction();

            var viewModel = UserFormViewModel.CreateTipFormViewModel();
            viewModel.User = user;
            viewModel.Teams = teamRepository.GetAll();
            viewModel.Games = gameRepository.GetAll();
            return View(viewModel);
        }