Ejemplo n.º 1
0
 public List<RestaurantEntity> getAll()
 {
     //string mysql = "SELECT * FROM yumiyumi.yumi_account where user_name ='"+email+"'";
     string mysql = "SELECT * FROM yumiyumi.yumi_brand";
     MySqlDataReader myreader = MySqlHelper.ExecuteReader(mysql);
     List<RestaurantEntity> resturantsList = new List<RestaurantEntity>();
     while (myreader.Read())
     {
         RestaurantEntity resturant = new RestaurantEntity();
         resturant.id = myreader.GetInt32(0);
         resturant.name = myreader.GetString(1);
         resturant.photo = myreader.GetString(2);
         resturant.description = myreader.GetString(3);
         resturant.location = myreader.GetString(4);
         resturantsList.Add(resturant);
     }
     myreader.Close();
     return resturantsList;
 }
Ejemplo n.º 2
0
 public List<RestaurantEntity> getByName(string name)
 {
     //string mysql = "SELECT * FROM yumiyumi.yumi_account where user_name ='"+email+"'";
     string mysql = "SELECT * FROM yumiyumi.yumi_brand where brand_name like ?name";
     MySqlParameter[] parameters = {
             new MySqlParameter("?name", MySqlDbType.VarChar, 255),
             };
     parameters[0].Value = "%"+name+"%";
     MySqlDataReader myreader = MySqlHelper.ExecuteReader(mysql, parameters);
     List<RestaurantEntity> resturantsList = new List<RestaurantEntity>();
     while (myreader.Read())
     {
         RestaurantEntity resturant = new RestaurantEntity();
         resturant.id = myreader.GetInt32(0);
         resturant.name = myreader.GetString(1);
         resturant.photo = myreader.GetString(2);
         resturant.description = myreader.GetString(3);
         resturant.location = myreader.GetString(4);
         resturantsList.Add(resturant);
     }
     myreader.Close();
     return resturantsList;
 }