Status of sale in C #

-3

Good afternoon guys, are you okay?

I'm creating a car rental system in C # and would like to implement a function that returns all cars to me and a column that shows whether the requested car is leased or not, if it is leased, the ball would be green and else, the red ball and that would automatically change when making the lease. I have already researched in several places but I do not find, Here is an example:

The query I can do, the problem is this variable STATUS

    
asked by anonymous 28.05.2018 / 22:27

1 answer

-1

There are several ways to do this check, for example, using 0 for unavailable and 1 for available, create a function that changes the status of that variable for the rented car from 0 to 1. Then just add this value in the table that mounted status.

You can also use the bool lib that is based on the same principle, only using true and false . Example:

#include<stdbool.h>

bool setStatus(carro){
    if(carro == Alugado){
        return true;
    }
    return false;
}
    
28.05.2018 / 22:36