This is probably really basic in C#, but I looked around a lot to find a solution.
In my MVC controller\'s action method, I have an incoming routeid (programid
This is a scoping problem. Anything inside of braces {} is defined as a block. Any variables defined in a block are only available within that block and are garbage collected when you exit the block.
Don't define accountType inside the blocks in your if statement:
string accounttype;
if (programid == 0)
{
accounttype = "Membership";
}
else
{
accounttype = "Program";
}