public async Task <ActionResult <List <Student> > > GetAllStudents() { using (var connection = new SqlConnection(Configuration.GetConnectionString("DefaultConnection"))) { try { connection.Open(); return(await StudentsRepository.GetAllStudentsAsync(connection)); } catch (Exception ex) { return(BadRequest(ex.Message)); } } }