connecting my Denon receiver to the TV

At the monent I have the following set up:
TV lg smart tv model-47lm640 to lg 300w sound bar model-nb3520a using optical audio out on the Tv to optical in on the soundbar.That is working perfectly.
I bought a Denon receiver model 1312 and connect the skybox to the Receiver via Audio on the skybox to the in on the receiver and in that way i am getting the sound from the box through the receiver to play my Bose 301 series III speakers.
However,I want to pass the Tv and my sound bar through my receiver because at the moment if I am playing music on the TV or watching a movie through my hard drive or any other device,I am not getting the sound through the receiver to play my bose speakers that is connected to the receiver. How do I connect the tv throught the receiver to get tha sound.I have tried the hdmi cable and the optical cable from the Tv to the receiver and this is not working. Maybe i am setting on the Tv and the receveir on the correct settings.