public IActionResult GetStudents(string orederBy) { var list = new List <Śtudent>(); using (var client = new SqlConnection("Data Source=db-mssql;Initial Catalog=s19488;Integrated Security=True")) using (var command = new SqlCommand()) { command.Connection = client; command.CommandText = "select * from Student"; client.Open(); var reader = command.ExecuteReader(); while (reader.Read()) { while (reader.Read()) { list.Add(new Śtudent() { FirstName = reader["FirstName"].ToString(), LastName = reader["LastName"].ToString(), IndexNumber = reader["IndexNumber"].ToString(), BirthDate = DateTime.Parse(reader["BirthDate"].ToString()) }); } } } return(Ok(_dbService.GetStudents())); }
public IActionResult GetStudents(string orederBy) { return(Ok(_dbService.GetStudents())); }