The Prophet (peace and blessings be upon him) said: "Whoever offered his sacrifice before the prayer should do it again."