public bool CheckUsername(string username)
{
bool exists=false;
var query =
from t in db.Coaches
where String.Equals(t.user_name,username)
select t;
List<Coach> coaches = query.ToList();
if (coaches.Count!=0)
{
exists = true;
}
else
{
exists = false;
}
return exists;
}
This is my function. If for example the username james
exists I want the users to still be able to create another user with username James
, JAMES
, ... etc for as far as I know String.equals()
is case-sensitive but my function does not work. Any idea why this isn't working? I tried using compare but this does not work because it returns an int.