حَضَرَ أَخُوكَ، وَأَكْرَمْتُ أَخَاكَ.
Translation: Your brother arrived, and I honoured your brother.
In the first clause, أَخُو is a nominative subject with wāw. In the second, أَخَا is an accusative direct object with alif.
تَحَدَّثْتُ إِلَى أَخِيكَ.
Translation: I spoke to your brother. «إِلَى» is a preposition, so «أَخِي» is genitive with yāʾ.
Practice principle: Identify the syntactic role first; then name the case sign.