I have tried to below suggestions but nothing works, and I have edited the code to be easier. the purpose of this code is to get the row of the data based on the enum.
For example: if I give the value "bra" for search, then the wanted result should be brazil from enum but since the enum is an int then it's like I'm saying select the data where location = 3 if we suppose that brazil =3 in the enum.
public LocationType Location { get; set; }
public enum LocationType
{
brazil,
USA,
UK
}
public async Task<IActionResult> Index(string id, [FromForm] string search)
if (!string.IsNullOrWhiteSpace(search))
{
result = applicationDbContext.Where(x => x.Location.ToString().Contains(search)).ToList();
}
note: search is string input.