Given the Asgardians superior technology, (they are aliens, not gods) resisting bullets seems almost child's play.
In Loki's case, he most likely used a defensive "spell" to protect himself. Loki, despite his being only a fraction as strong as Thor, physically, seemed quite damage-resistant and was able to survive a physical confrontation with the Hulk. The average Asgardian may not be in Superman's league for overall damage resistance, but human handheld weaponry holds no fear for them. The Asgardians are tough, strong and more than a match for any conventionally-armed team of humans.
In the comics, there is some debate as to whether the Asgardians are truly bullet-proof or does their armor protect them, but for the most part, anyone able to claim three times human density in their skin and muscle fibers, superhuman strength on the order of being able to lift at least 10 tons (average Asgardian), most of the well-known can lift significantly more, and wearing armor crafted by an dwarven-smith, most should not have to worry too much about bullets or small arms. Thor is so strong he can just stand there and wait for his enemies to run out of bullets.
Thor deflects bullets by standing there.