public IList <Pupil> GetAllPupils() { SqlConnection connection = (SqlConnection)GetConnection(); SqlCommand command = new SqlCommand(SELECT_ALL_PUPILS, connection); SqlDataReader reader = command.ExecuteReader(); IList <Pupil> list = new List <Pupil>(); if (reader.HasRows) { while (reader.Read()) { Pupil pupil = new Pupil(); pupil.Surname = reader.GetString(1); pupil.Name = reader.GetString(2); pupil.Passport = reader.GetString(3); pupil.Birthday = reader.GetDateTime(4); pupil.Rating = reader.GetFloat(5); list.Add(pupil); } } ReleaseConnection(connection); return(list); }