My problem is how to avoid duplication of username in xamarin using firebase.
My expected output is upon tapping the username field, if in the database, "usernametest123" is already in there and a new customer upon his/her creating account to my app, and enter a username "usernametest123", a toast will appear like "Username is already exist". I tried this way; my code behind. `
async public void CreateAccount_Clicked(System.Object sender, System.EventArgs e)
{
try{
//thats how I declare some variable up to my 11 input fields
string FName = textfield_Firstname.Text;
if (string.IsNullOrEmpty(FName )){await this.DisplayToastAsync("Please Enter your first name", 1500);}
//up to 11 input fields also
CUSTOMER customer = new CUSTOMER();
customer.CustomerFName = FName;
var Savedata = await customerRepo.Save(customer);
}
catch(Exception ex){
if(ex.Message.Contains("USERNAME_EXISTS"))
{
await this.DisplayToastAsync("Username already Exist", 1500);
}
else
{
await this.DisplayToastAsync(ex.Message,1500);
}
}
}
` any link that will posted about my concern will be appreciated thank you so much