zero or negative values not being posted to database
Im having a problem where my code is doing what I expect unless the current value in the database is 1 or null. the type im working with here is int? (NULLABLE).

    if (comment.GoodPointRateing.HasValue) 
                    comment.GoodPointRateing -= 1; 
                else 
                    comment.GoodPointRateing = -1; 

 - First I check if the int has a value because its nullable, if it does I minus one from the count. If it does not have a value, we cant minus from a null so I set the int to -1.

 - If the database had a value of 2 or greater decrementing works

 -  if the database had a value of one, the decrement does not work if the database was null it stays null

Does anyone know why the code is behaveing like this ?


zero or negative values not being posted to database
===

Im having a problem where my code is doing what I expect unless the current value in the database is 1 or null. the type im working with here is int? (NULLABLE).

    if (comment.GoodPointRateing.HasValue) 
                    comment.GoodPointRateing -= 1; 
                else 
                    comment.GoodPointRateing = -1; 

 - First I check if the int has a value because its nullable, if it does I minus one from the count. If it does not have a value, we cant minus from a null so I set the int to -1.

 - If the database had a value of 2 or greater decrementing works

 -  if the database had a value of one, the decrement does not work if the database was null it stays null

Does anyone know why the code is behaveing like this ?

