A federal appeals court upheld the core parts of gun control laws in New York and Connecticut that ban semiautomatic weapons and high-capacity magazines.