You need a few things to update both child + parent records in the same trigger :
1)parent MUST be inserted before child.
2)there MUST be a relation between child and parent before you insert them.
3)some sort of “temporary holder” for the parent ID before it is associated with the child (here he has used external IDs)
1)create a parent with an external ID.
2)create a child with same external ID as parent’s.
3)insert the parent FIRST and then the child.
Try this,i think this may help you.