public ActionResult Edit()
        {
            var user = GetUser();

            if (user != null)
            {
                var model = new EditUserModel
                {
                    Login = user.UserName,
                    FirstName = user.FirstName,
                    LastName = user.LastName,
                    Patronymic = user.Patronymic,
                    Email = user.Email,
                    PositionId = user.Position.Id
                };
                ViewBag.Positions = _positionsHandler.PositionsSelectList();
                ViewBag.FullName = GetUserName();
                return View(model);
            }
            FormsAuthentication.SignOut();
            return RedirectToAction("Login", "Account");
        }
 public async Task<ActionResult> EditUser(EditUserModel model)
 {
     if (ModelState.IsValid)
     {
         ApplicationUser user = await UserManager.FindByIdAsync(model.Id);
         if (user != null)
         {
             user.FirstName = model.FirstName;
             user.LastName = model.LastName;
             user.Patronymic = model.Patronymic;
             user.Position = model.Position;
             IdentityResult result = await UserManager.UpdateAsync(user);
             if (result.Succeeded)
             {
                 return RedirectToAction("Users");
             }
             else
             {
                 ModelState.AddModelError("", "Что-то пошло не так");
             }
         }
     }
     return View("Edit/EditUser", model);
 }
        public ActionResult Edit(EditUserModel model)
        {
            var user = GetUser();

            if (user != null)
            {
                user.Email = model.Email;
                user.UserName = model.Login;
                user.FirstName = model.FirstName;
                user.LastName = model.LastName;
                user.Patronymic = model.Patronymic;
                user.Position = _positionsRepositoryHandler.FindById(model.PositionId);

                _usersRepositoryHandler.Update(user);
                return RedirectToAction("Index", "Main");
            }
            ModelState.AddModelError("", "Не удалось найти пользователя. Попробуйте еще раз.");
            return RedirectToAction("Index", "Main");
        }