예제 #1
0
        public UserPasswordChangedReturnDto ChangePassword(int userId, UpdatePasswordDto passWords)
        {
            if (_userOperations.UserExists(userId))
            {
                return(null);
            }
            var user = _userOperations.GetUserById(userId);

            if (passWords.OldPassword == passWords.NewPassword)
            {
                return(null);
            }
            var changedUser = _userOperations.ChangePassword(user, passWords.OldPassword, passWords.NewPassword);

            return(changedUser == null ? null : Mapper.Map <UserPasswordChangedReturnDto>(changedUser));
        }