In my database, I have a table that stores cities. Some cities have accents like "Foz do Iguaçu".
In my MVC application, I have a JSON that return a list of cities based in a word, however, few users aren't using accents to search for the city, for example "Foz do Iguacu".
in my database I have "Foz do IguaÇu" but users users searches for "Foz do IguaCu"
How can I search records in my table, ignoring accents?
Here is my code:
using (ServiciliEntities db = new ServiciliEntities())
{
List<Cidades> lCidades = db.Cidades.Where(c => c.CidNome.ToLower().Contains(q.Trim().ToLower())).OrderBy(c => c.CidNome).Take(10).ToList();
ArrayList lNomes = new ArrayList();
foreach (Cidades city in lCidades)
lNomes.Add(new {city.CidNome, city.Estados.EstNome});
return Json(new { data = lNomes.ToArray() });
}