I do not believe that the exchange should have happened in the first place although I believe it to be legal. The President did not consult with Congress about the exchange but I believe that he was well within his rights as well. Although I do believe that he should have sought their approval before making that decision. Although possibly a terrible decision, none of these actions are illegal.
Unfortunately the trade that took place was in essence, legal, as the United States Government allows for making such deals. I find it hypocritical, however, that we as Americans hear our leaders say, "We do not negotiate with terrorists." not only did the US Government negotiate with known and active terrorists, but they also got a sweet deal of five of theirs in trade for only one of ours.
While all legal measures were probably taken to make the exchange, prior to the exchange or its conception there were ethical questions which translate to moral dilemmas. It was already alleged that Bergdahl was a deserter of his men, not just a foot soldier who deserted his comrades, but a leader that allegedly left men behind to die. These allegations have been confirmed by 'smaller sources' in that they have not been done in a military court to date, but the soldiers involved in his particular unit have confirmed the desertion which should have raised a red flag morally from the start. In the farcical war on terror, the greatest threat is still the Taliban particularly for the poor people of Afghanistan and Pakistan and many of its surrounding areas as they spread their terror on small, defenseless villages. While a trade was legal and was possibly the only way to get justice for the men that were deserted trading five men for one should not have been done at all. If nothing else, the Taliban's move to ask for five men in trade for one American makes a statement to their people that the Americans are worth a great deal and their own leaders are not worth many American hostages instead. This was very poorly handled in the trading of five total men or even a trade at all since military courts can hold trials for such things without the person present (particularly a deserter who was captured because of desertion). Yes, basic legalities were followed; but the spirit of the law itself which is far more important as it is the very rudiments that creates law were tossed aside in the lack of moral or ethical considerations in the 'trade'.
President Obama's exchange of five Taliban leaders violated a law established in 2013 requiring congress to be notified thirty days in advance of such action. No such notification was given. His defense that the law was not constitutional is not acceptable as the judicial branch, not the executive, is exclusively empowered to determine constitutionality.