I was with Messenger of Allah ﷺ on the day of 'Id al-Adha. While he had not returned after having offered (the Id prayer) and finished it, he saw the flesh of the sacrificial animals which had been slaughtered before he had completed the prayer. Thereupon he (the Holy Prophet) said: One who slaughtered his sacrificial animal before his prayer or our prayer ('Id), he should slaughter another one in its stead, and he who did not slaughter, he should slaughter by reciting the name of Allah.
شَهِدْتُ الأَضْحَى مَعَ رَسُولِ اللَّهِ ﷺ فَلَمْ يَعْدُ أَنْ صَلَّى وَفَرَغَ مِنْ صَلاَتِهِ سَلَّمَ فَإِذَا هُوَ يَرَى لَحْمَ أَضَاحِيَّ قَدْ ذُبِحَتْ قَبْلَ أَنْ يَفْرُغَ مِنْ صَلاَتِهِ فَقَالَ مَنْ كَانَ ذَبَحَ أُضْحِيَّتَهُ قَبْلَ أَنْ يُصَلِّيَ أَوْ نُصَلِّيَ فَلْيَذْبَحْ مَكَانَهَا أُخْرَى وَمَنْ كَانَ لَمْ يَذْبَحْ فَلْيَذْبَحْ بِاسْمِ اللَّهِ