Kyrie Irving poured in 45 points as the Brooklyn Nets snapped a five-game losing streak by beating the Detroit Pistons.