public IHttpActionResult CheckPasswordHistory(string ResetPasswordCode, string apiAccessKey)
        {
            int count  = 0;
            int retVal = 0;

            var securityQuestionData = new PasswordHistoryDTO();
            var userProfileDto       = new ProfileDTO();

            LogWsData("ResetPasswordCode :" + ResetPasswordCode);
            var objsecurityQuestionDto = new PasswordHistoryDTO();

            try
            {
                if (AccesKey == apiAccessKey)
                {
                    using (var client = ServiceClient <IPasswordHistoryManager> .Create(ObjectConstants.PasswordHistoryManager))
                    {
                        objsecurityQuestionDto.ResetPasswordCode = ResetPasswordCode;
                        securityQuestionData = client.Instance.GetPasswordResetCode(ResetPasswordCode);
                    }
                }
            }
            catch (Exception ex)
            {
                LogWsData("Exception CheckQuestionsAnswer: " + ex);
            }
            return(Ok(securityQuestionData.PasswordHistoryList));
        }
        public string ResetPassword(string guid, string userPassword, string userIpAddress, string oneTimePassword, string passwordReceivedVia, string apiAccessKey)
        {
            LogWsData("GUID :" + guid);

            //var loginHistoryDto = new PasswordHistoryDTO();
            var  loginDto       = new LoginDTO();
            var  userProfileDto = new ProfileDTO();
            long retVal         = 0;

            try
            {
                int    salt        = Password.CreateRandomSalt();
                string haspassword = Password.HashPassword(userPassword, salt);

                if (AccesKey == apiAccessKey)
                {
                    LogWsData("GUID :" + guid);
                    if (AccesKey == apiAccessKey)
                    {
                        using (var client = ServiceClient <IUserProfileManager> .Create(ObjectConstants.UserProfileManager))
                        {
                            var objuserProfileDto = new ProfileDTO {
                                GUID = guid
                            };
                            userProfileDto = client.Instance.GetUserProfileById(objuserProfileDto);
                        }
                        using (var client = ServiceClient <IPasswordHistoryManager> .Create(ObjectConstants.PasswordHistoryManager))
                        {
                            var objLoginHistoryDto = new PasswordHistoryDTO
                            {
                                GUID                 = guid,
                                ProfileId            = Convert.ToInt64(userProfileDto.ProfileList[0].ProfileId),
                                PasswordSalt         = salt,
                                HashedPassword       = haspassword,
                                PasswordReceivedVia  = passwordReceivedVia,
                                OneTimePassword      = oneTimePassword,
                                CreatedFromIPAddress = userIpAddress,
                                IsActive             = true,
                                CreatedBy            = Convert.ToInt64(userProfileDto.ProfileList[0].ProfileId),
                                CreatedDate          = DateTime.Now,
                            };
                            retVal = client.Instance.Save(objLoginHistoryDto);
                        }

                        if (retVal != 0)
                        {
                            using (var client = ServiceClient <ILoginManager> .Create(ObjectConstants.LoginManager))
                            {
                                var objloginDto = new LoginDTO
                                {
                                    GUID = guid,
                                };
                                loginDto = client.Instance.GetLoginByUserProfileId(objloginDto);
                            }
                            using (var client = ServiceClient <ILoginManager> .Create(ObjectConstants.LoginManager))
                            {
                                loginDto.LoginList[0].PasswordSalt         = salt;
                                loginDto.LoginList[0].HashedPassword       = haspassword;
                                loginDto.LoginList[0].CreatedFromIPAddress = userIpAddress;
                                loginDto.LoginList[0].UpdatedBy            = Convert.ToInt64(loginDto.ProfileId);
                                loginDto.LoginList[0].UpdatedDate          = DateTime.Now;

                                retVal = client.Instance.UpdateLoginPassword(loginDto.LoginList[0]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogWsData("Exception CheckQuestionsAnswer: " + ex);
            }

            return(retVal.ToString());
        }