How does the Presidential Primary Work?

The presidential primary works like this.The states have a primary and with the winner of the primary takes all of the state votes to their respective convention.The emocrat party split the primary votes based on the percentage of votes received by a candidate and in some states the Republican party does the same