public ActionResult ChangePassword(string newpassword, string confirmpassword) { if (newpassword != "" || confirmpassword != "") { if (newpassword != confirmpassword) { ViewBag.Error = clsCommon.NotMatchingPassword; return(View()); } else { UserModel u = (UserModel)Session[clsCommon.enmSessions.SessionLoggedInUser.ToString()]; clsCommon comm = new clsCommon(); UserModel user = comm.ChangePassword(u, newpassword); if (user != null) { Session[clsCommon.enmSessions.SessionLoggedInUser.ToString()] = user; return(RedirectToAction("Index", "Center")); } else { ViewBag.Error = clsCommon.InvalidLoginError; return(View("CenterLogin", "Center")); } } } else { ViewBag.Error = clsCommon.PleaseEnterPassword; return(View()); } }