I created a search method and if I'm looking for a word (for ex: "ünsüz") , I want to search this word when I type "unsuz" too. For this I'm trying to convert "ünsüz" to "unsuz" but I get an error. What am I doing wrong here?
public PartialViewResult Search(string searchKey)
{
string infoItem = "";
var shortDescItem = "";
viewModel = new SearchModel();
viewModel.SearchKey = searchKey;
var unaccentedText = String.Join("", searchKey.Normalize(NormalizationForm.FormD)
.Where(c => char.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)).Replace('ş', 's').Replace('ç', 'c').Replace('ı', 'i').Replace('ü', 'u').Replace('ö', 'o').Replace('ğ', 'g');
foreach (var item in _context.Test.Where(m => m.IsDeleted == false && (m.StartDate < DateTime.Now && m.EndDate > DateTime.Now || m.StartDate == DateTime.MinValue || m.EndDate == DateTime.MinValue)).OrderBy(m => m.Order).ToList())
{
infoItem = item.Info.ToLower().Replace('ş', 's').Replace('ç', 'c').Replace('ı', 'i').Replace('ü', 'u').Replace('ö', 'o').Replace('ğ', 'g');
shortDescItem = item.ShortDescription.ToLower().Replace('ş', 's').Replace('ç', 'c').Replace('ı', 'i').Replace('ü', 'u').Replace('ö', 'o').Replace('ğ', 'g');
}
viewModel.TestList = _context.Test.Where(infoItem.Contains(unaccentedText).ToString()).ToList();
return PartialView("ResultView", viewModel);
}
Where(infoItem.Contains(unaccentedText) shows up an error as cannot convert from 'string' to 'System.Linq.Expressions.Expression<System.Func<Project.Application.Entities.TestEntity, bool>>'