예제 #1
0
        public async Task <ActionResult <IEnumerable <Grand> > > ToGrand()
        {
            var authors = new List <Grand>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                string     sql     = "select * from CarBrand";
                SqlCommand command = new SqlCommand(sql, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    authors.Add(HelperOper.ADONetToClass <Grand>(reader));
                }
            }
            await _tool.GetGrand();

            return(Ok(authors));
        }