public ActionResult Edit(int id)
        {
            var viewModel = UserFormViewModel.CreateTipFormViewModel();

            viewModel.User  = UserRepository.Get(id);
            viewModel.Teams = teamRepository.GetAll();
            viewModel.Games = gameRepository.GetAll();

            this.SetBreadcrumbText(viewModel.User.Login);

            return(View(viewModel));
        }
        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));
        }