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)); }
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)); }
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)); }
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)); }
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)); }