What was the difference between Cornwallis' surrender and Robert E. Lee's surrender at the conclusion of the war?

Well, when Cornwallis surrendered, it had been just a battle that he lost. But when Robert E. Lee surrendered it was the whole reason to why the confederates lost the Civil War.