Пример #1
0
        public string ChangePassword(int userID, string oldPassword, string newPassword)
        {
            try
            {
                tblUser user = unitOfWork.TblUserRepository.GetByID(userID);

                if (HashPassword.CompareHash(oldPassword, user.Password))
                {
                    user.Password = HashPassword.Genaratehash(newPassword);
                    unitOfWork.TblUserRepository.Update(user);
                    unitOfWork.Save();

                    return("SUCCESS");
                }
                else
                {
                    return("WOP");
                }
            }
            catch (Exception ex)
            {
                return("UE");
            }
        }