I have the following code to retrieve a name when a user enters the name in the search box and the function searches the name from Student model. Please find below the code. However, it doesn't show anything.
public Student SearchName(string search)
{
var student = _context.Student.FirstOrDefault(a => a.Name == search);
var student = from a in _context.Student
select a;
if(!String.IsNullOrEmpty(search))
{
student = student.Where(a => a.Name!.Contains(search))
}
return student;
}