public ActionResult ChangePassword(ChangePasswordViewModel vm) { if (ModelState.IsValid) { var citizen = citizensRepository.GetByCredentials(SessionHelper.LoggedCitizen.Entity.Name, vm.OldPassword); var result = authService.CanChangePassword(citizen, vm.OldPassword, vm.NewPassword); if (result.IsError) { AddError(result); } else { authService.ChangePassword(citizen, vm.NewPassword); AddSuccess("Your password was changed!"); return(RedirectToAction("Index", "Home")); } } return(View(vm)); }