Hi community,
When implementing a web service, I have a GET method with a parameter :
public int GetMethod(string name)
In this method, I did a query to get the age of the person in parameter :
var select = new Select(UserConnection)
.Column("Age")
.From("Contact")
.Where("Contact", "Name").IsEqual(Column.Parameter(name)) as Select;
Then I save the age into an int var :
var age = select.ExecuteScalar();
return age;
The problem is the following :
How can I check if the name of a contact in the method parameter exsists in the DB or not ?
Example :
if(name != exists) {
return 0;
} else {
return age;
}
Thanks a lot.
Best regards,
Jonathan