which general served during the mexican war and the civil war