I'm a crate trainer. (Even if you don't want to crate your dog, it's important to get them used to it, because at some point... vet, groomer, etc..... they will need to be comfortable in a crate. Both of mine were pretty easy to crate train. I gave them a great treat and said "kennel" every single time they went in.... even if they were just exploring the kennel on their own. Now, if I'm leaving, I'll say "kennel" as I'm getting ready to leave. Nine times out of ten, I can't find Coby... only to find him waiting inside the kennel tapping his foot impatiently for his treat.
I've also found that if I cover the crate (like a birdcage) that stops the barking or whining 99% of the time.