public ActionResult ChangePassword(ChangePasswordViewModel model) { bool passChanged = false; UserLoginViewModel user = Session["UserModel"] as UserLoginViewModel; if (WebApiClient.ValidateUser(user.UserName, model.OldPassword) != null) { passChanged = WebApiClient.ChangePassword(user.UserName, model.NewPassword); ViewData["PassChangeMessage"] = passChanged ? "Your Password has been changed successfully!" : "Something Went wrong. Please try again later"; ViewData["PasswordChanged"] = passChanged; } else { ViewData["PassChangeMessage"] = "Please enter correct old password"; } return(View(model)); }