This Will return only when the user is available at the same case
public async Task<IActionResult> Index(string UserSearch)
{
ViewData["GetUserDDetails"] = UserSearch;
var UserQuery = from x in _context.Users select x;
if (!string.IsNullOrEmpty(UserSearch))
{
UserQuery = UserQuery.Where(x => x.Username.Contains(UserSearch) || x.Email.Contains(UserSearch));
}
return View(await UserQuery.AsNoTracking().ToListAsync());
}
2
Answers
Use .ToLower() or .ToUpper() on both the query value and the subject value.
Try this: