Пример #1
0
        public ActionResult <IEnumerable <CarDetails> > ten(string ToName, string Topin)
        {
            var Rather = new List <CarDetails>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                SqlCommand command = new SqlCommand($"select * from carinfo where carName like '%{ToName}%' or AMT like '%{Topin}%'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Rather.Add(ConnHelper.ADONetToClass <CarDetails>(reader));
                }
            }
            return(Ok(Rather));
        }
Пример #2
0
        public ActionResult <IEnumerable <CarDetails> > GetListOfAuthors()
        {
            var authors = new List <CarDetails>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                SqlCommand command = new SqlCommand("select * from Carinfo", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    authors.Add(ConnHelper.ADONetToClass <CarDetails>(reader));
                }
            }

            return(Ok(authors));
        }