[HttpGet("{id?}")] // handles /students and /students/:id: public IActionResult Read(int id) { if (id == default(int)) { return(Ok(classroom.getAll())); } return(Ok(classroom.get(id))); }
public IActionResult ReadOne(int id) { var student = classroom.get(id); if (student == null) { return(NotFound()); //404 } return(View(student)); }