public async Task <ActionResult> UnLock(string id)
        {
            UserLockoutViewModel viewModel = new UserLockoutViewModel();

            if (!String.IsNullOrEmpty(id))
            {
                WebApplication2User user = await userManager.FindByIdAsync(id);

                if (user != null)
                {
                    bool isLockedOut = await userManager.IsLockedOutAsync(user);

                    if (!isLockedOut)
                    {
                        return(RedirectToAction("Index"));
                    }

                    viewModel.Id             = user.Id;
                    viewModel.UserName       = user.UserName;
                    viewModel.Surname        = user.Surname;
                    viewModel.FirstName      = user.FirstName;
                    viewModel.MiddleName     = user.MiddleName;
                    viewModel.Email          = user.Email;
                    viewModel.EmployeeNumber = user.EmployeeNumber;

                    return(View(viewModel));
                }
            }

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> UnLock(string id, UserLockoutViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    WebApplication2User user = await userManager.FindByIdAsync(id);

                    if (user != null)
                    {
                        bool isLockedOut = await userManager.IsLockedOutAsync(user);

                        if (!isLockedOut)
                        {
                            return(RedirectToAction("Index"));
                        }

                        IdentityResult userResult = await userManager.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow.AddDays(-1));

                        if (userResult.Succeeded)
                        {
                            IdentityResult resetResult = await userManager.ResetAccessFailedCountAsync(user);

                            IdentityResult lockoutResult = await userManager.SetLockoutEnabledAsync(user, false);

                            if (lockoutResult.Succeeded)
                            {
                                return(RedirectToAction(nameof(Index)));
                            }
                        }
                        else
                        {
                            AddErrors(userResult);
                            return(View(viewModel));
                        }
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, "There was an error");
                return(View(viewModel));
            }
        }