I would like to have a controller with multiple GET, one for all, one with int parameter and the other with a string parameter. The following example still give me error:
[ApiController]
[Route("[controller]")]
public class StudentsController : ControllerBase
{
[HttpGet]
public IEnumerable<Student> Get()
{
return GetStudents();
}
[HttpGet("{id}")]
public Student Get(int id)
{
return GetStudents().FirstOrDefault(s=> s.id == id);
}
[HttpGet("{name}")]
public Student Get(string name)
{
return GetStudents().FirstOrDefault(s=> s.name == name);
}
}
EDIT Current I get the following error
