I have a db column userstatus where default is true. Now I have a checkbox which allows the user to checked on it to disable the user. But now even I checked on the checkbox the user status is still showing true in the database. How can I fix this issue.
Here is the View:
<CheckBox x:Name="cbUserStatus" Content="Disable" IsChecked="{Binding UserStatus}"/>
Here is the code behind the View:
int userStatus = Convert.ToInt32(cbUserStatus.IsChecked.Value);
try
        {
            string query = "Update users set USER_FIRSTNAME = '" + firstName + "', USER_ROLE = '"+ userRole + "', USER_STATUS = '"+ userStatus +"' where ID = " + id;
            db.QueryCommand(query);
            MessageBox.Show("User updated successfully");
            this.Close();
            admin_home adminWindow = new admin_home();
            adminWindow.Show();
        }
        catch (MySqlException ex)
        {
            MessageBox.Show(ex.ToString());
        }
Here is my user Model:
 private bool userstatus;
    public bool UserStatus
    {
        get { return (userstatus == false) ? true : false; }
        set
        {
            userstatus = value;
            OnPropertyChanged("UserStatus");
        }
    }
 
     
     
    