public IActionResult setChangePassword(ChangePasswordModel objChangePassword) { string ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); Int32? UserID = HttpContext.Session.GetInt32("UserID"); string ErrorMessage = string.Empty; try { //string pw = SecurityHelperService.Decrypt("ueNl4Gl98pKy3m0G6CaqBsi6jSC58DX8"); var Result = ""; var Actions = ""; objChangePassword.NewPassword = SecurityHelperService.Encrypt(objChangePassword.NewPassword); objChangePassword.OldPassword = SecurityHelperService.Encrypt(objChangePassword.OldPassword); var data = Encoding.UTF8.GetBytes(objChangePassword.Role); var Role = Convert.ToBase64String(data); if (HttpContext.Session.GetInt32("UserID") != null) { if (objChangePassword.Role == "InternalUser") { Actions = "UserLogin"; //IEnumerable<User> objDatawithSP = _empRepository.CheckUserPassword(); //objDatawithSP = objDatawithSP.Where(x => x.Password == objChangePassword.OldPassword && x.Email == objChangePassword.Email); User objDatawithSP = _empRepository.CheckUser(objChangePassword.Email, objChangePassword.OldPassword); if (objDatawithSP != null) { Result = objDatawithSP.Password; } } if (objChangePassword.Role == "MasterAdmin") { Actions = "AdminLogin"; //IEnumerable<Company> objDatawithSP = _empRepository.CheckAdminPassword(); ////objDatawithSP = objDatawithSP.Where(x => x.Password == objChangePassword.OldPassword && (x.Email == objChangePassword.Email || x.PANNumber == objChangePassword.Email)); //objDatawithSP = objDatawithSP.Where(x => x.Password == objChangePassword.OldPassword && x.Pan_number == objChangePassword.Email); Company objDatawithSP = _empRepository.CheckAdmin(objChangePassword.Email, objChangePassword.OldPassword); if (objDatawithSP != null) { Result = objDatawithSP.Password; } } if (objChangePassword.Role == "SuperAdmin") { Actions = "SuperAdminLogin"; //IEnumerable<FinocartMaster> objDatawithSP = _empRepository.CheckSuperAdminPassword(); //objDatawithSP = objDatawithSP.Where(x => x.Password == objChangePassword.OldPassword && x.EmailId == objChangePassword.Email); FinocartMaster objDatawithSP = _empRepository.CheckSuperAdmin(objChangePassword.Email, objChangePassword.OldPassword); if (objDatawithSP != null) { Result = objDatawithSP.Password; } } if (Result != "") { var Data = _empRepository.UpdateNewPassword(objChangePassword); return(RedirectToAction(Actions, "Account")); } else { TempData["WrongPassword"] = "******"; return(RedirectToAction("ChangePassword", "Common", new { RoleName = Role })); } } else { return(RedirectToAction("ChangePassword", "Common", new { RoleName = Role })); } } catch (Exception ex) { var st = new StackTrace(ex, true); var frame = st.GetFrame(0); int ErrorLine = frame.GetFileLineNumber(); var Result = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID); return(RedirectToAction("ErrorPage", "Common")); } }