public IActionResult updateNewPassword(ChangePasswordModel changePassword)
        {
            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;
            var    lstEmailIDofBank = _companyRepository.GetAnchorEmail(Convert.ToString(changePassword.UserId));

            changePassword.Email = lstEmailIDofBank.ElementAt(0).Contact_email;
            try
            {
                var Result  = "";
                var Actions = "";
                changePassword.NewPassword = SecurityHelperService.Encrypt(changePassword.NewPassword);
                changePassword.OldPassword = SecurityHelperService.Encrypt(changePassword.OldPassword);
                var data = Encoding.UTF8.GetBytes(changePassword.Role);
                var Role = Convert.ToBase64String(data);
                if (HttpContext.Session.GetInt32("UserID") != null)
                {
                    if (changePassword.Role == "InternalUser")
                    {
                        Actions = "UserLogin";
                        User objDatawithSP = _empRepository.CheckUser(changePassword.Email, changePassword.OldPassword);
                        if (objDatawithSP != null)
                        {
                            Result = objDatawithSP.Password;
                        }
                    }
                    if (changePassword.Role == "MasterAdmin")
                    {
                        Actions = "AdminLogin";
                        Company objDatawithSP = _empRepository.CheckAdmin(changePassword.Email, changePassword.OldPassword);
                        if (objDatawithSP != null)
                        {
                            Result = objDatawithSP.Password;
                        }
                    }
                    if (changePassword.Role == "SuperAdmin")
                    {
                        Actions = "SuperAdminLogin";
                        FinocartMaster objDatawithSP = _empRepository.CheckSuperAdmin(changePassword.Email, changePassword.OldPassword);
                        if (objDatawithSP != null)
                        {
                            Result = objDatawithSP.Password;
                        }
                    }

                    if (Result != "")
                    {
                        var Data = _empRepository.UpdateNewPassword(changePassword);
                    }

                    else
                    {
                        TempData["WrongPassword"] = "******";
                        return(RedirectToAction("ChangePassword", "Common", new { RoleName = Role }));
                    }
                    if (Result != "")
                    {
                        string emailToAddress = lstEmailIDofBank.ElementAt(0).Contact_email;
                        string AnchorName     = lstEmailIDofBank.ElementAt(0).Contact_Name;
                        string BankName       = HttpContext.Session.GetString("LoginName");
                        string Template       = string.Empty;
                        int    Id             = 1;
                        IEnumerable <GetChangePasswordMailTemplate> lstAwaitedInvVendorsView = _companyRepository.GetChangePasswordMailTemplate(Template);
                        string path = lstAwaitedInvVendorsView.ElementAt(0).Template;
                        //string path = "";
                        string subject = "Change Password";
                        string body    = path;
                        body = body.Replace("@@User@@", AnchorName);
                        body = body.Replace("@@BankName@@", BankName);
                        body = body.Replace("@@mentiondateandtime", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
                        IEnumerable <LookupDetails> lookupDetails = _lookUpRepository.getLookupDetailByKey("SMTPInfo");
                        _CommonRepository.SendEmail(lookupDetails, emailToAddress, subject, body, true);
                    }
                    return(RedirectToAction(Actions, "Account"));
                }
                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"));
            }
        }