Check out / a1_german for more content.
It's one of the hardest things to do when you are starting to learn German. When do you use einem vs ein vs einen ? This video tries to explain the grammatical logic behind this.
FOR THE MALE NOUN (!)
ein - Nominativ
einen - Akkusativ
einem - Dativ