Since you mark all numbers in your original code as prime or not, you should already have a lookup table which you can use.
Alternatively you could create an array or use a simple
vector
[
^] or
list
[
^] to store them. Then when the user enters a value you can look it up in the container and report accordingly.
Sieve of Eratosthenes in C#[
^] is a sample article that should help.