Remove the semicolon at the end of your if statements.
That semicolon tells the compiler "I'm done with this" and whatever comes next is a new, unrelated statement
So this (note semicolon at the end of the if):
if (condition);
{
DoStuff();
}
is the same as
if (condition)
{
; // Empty statement, do nothing.
}
DoStuff();
so it says "check `condition`, but do nothing with the result. Then `DoStuff()`"
But this (note no semicolon before the opening braces):
if (condition)
{
DoStuff();
}
Says "check `condition`, and only if it's `true` should you execute the stuff in the braces and `DoStuff()`"