To control the beginning and end of a note, a technique known as tonguing is used. Without the trumpet, whisper the sound "taa". Notice that your tongue starts at the back of your top teeth, and you make the "taa" sound by quickly withdrawing it, and letting a stream of air begin from your outgoing breath.
Now place the mouthpiece against your lips. Let your tongue remain lightly between your lips, closing off the stream of air, as you build up pressure in your mouth. Quickly release your tongue, and the note will start, definitely and crisply. To stop the note, simply put your tongue back against your lips. The note will stop immediately, and your tongue will be in position to start the next note.
With the trumpet against your lips, try the "taa" sound on the note C. Practice until you can easily play C every time you try. This may take a while, so don’t get frustrated if you can’t do it consistently at first. Practice for short periods at a time and it will get easier as your lips and facial muscles develop.