It is hard to see how Trump can lose except on narrow issue of Green Card holders and visa holders. The visa holders can still be denied entry anyway because visas are issued by the State Department while entry is solely the prerogative of Homeland Security. 

In the USA as in Canada, this is a federal matter. In fact the democrats went after the Arizona law on the ground that it was not their business to patrol for illegals....

 Switzerland is the only federation I know where it seems that the Cantons have a large say in immigration and citizenship but still their federal state has the last word. (It is a bit like the power Quebec exercises in Canada by special arrangement).