Exemplo n.º 1
0
        public ActionResult <IEnumerable <va> > GetListOfva()
        {
            var authors = new List <va>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                string     sql     = "select * from Va v join CarType t on v.cid = t.CarTypeID join CarBrand b on v.bid = b.CarBrandID  where v.Vstate = 1";
                SqlCommand command = new SqlCommand(sql, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    authors.Add(HelperOper.ADONetToClass <va>(reader));
                }
            }

            return(Ok(authors));
        }
Exemplo n.º 2
0
        public ActionResult <IEnumerable <infoTool> > GetListOfAuthors()
        {
            var authors = new List <infoTool>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                string     sql     = "select * from CarInfo c join CarType t on c.cid=t.CarTypeID join CarBrand b on c.bid=b.CarBrandID";
                SqlCommand command = new SqlCommand(sql, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    authors.Add(HelperOper.ADONetToClass <infoTool>(reader));
                }
            }

            return(Ok(authors));
        }
Exemplo n.º 3
0
        public ActionResult <IEnumerable <TypeSee> > ToType()
        {
            var authors = new List <TypeSee>();

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

            return(Ok(authors));
        }
Exemplo n.º 4
0
        public ActionResult <IEnumerable <infoTool> > SelectvaOper(string carname, int carP, int carTyep)
        {
            var authors = new List <infoTool>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                string     sql     = $"select * from CarInfo c join CarType t on c.cid=t.CarTypeID join CarBrand b on c.bid=b.CarBrandID where c.CarName like '%{carname}%' or t.CarTypeID={carP} or b.CarBrandID={carTyep}";
                SqlCommand command = new SqlCommand(sql, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    authors.Add(HelperOper.ADONetToClass <infoTool>(reader));
                }
            }

            return(Ok(authors));
        }
Exemplo n.º 5
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));
        }