Exemplo n.º 1
0
 public List<Plato> GetPlato(string filtro, int id)
 {
     List<Plato> listPlato = new List<Plato>();
     con.Ejecutar(query: $"SELECT * FROM tbl_menu WHERE nombre LIKE %{filtro}% OR id = {id}");
     Plato m;
     if (con.rs.Read())
     {
         m = new Plato
         {
             Id = con.rs.GetInt32(0),
             Nombre = con.rs.GetString(1),
             Precio = con.rs.GetInt32(2)
         };
         listPlato.Add(m);
     }
     return listPlato;
 }
Exemplo n.º 2
0
 public List<Plato> GetPlatos()
 {
     List<Plato> listPlato = new List<Plato>();
     con.Ejecutar(query: "SELECT * FROM tbl_menu");
     Plato m;
     while (con.rs.Read())
     {
         m = new Plato
         {
             Id = con.rs.GetInt32(0),
             Nombre = con.rs.GetString(1),
             Precio = con.rs.GetInt32(2)
         };
         listPlato.Add(m);
     }
     return listPlato;
 }
Exemplo n.º 3
0
 public void AgregarPlato(Plato m)
 {
     string query = $"INSERT INTO tbl_menu VALUES('{m.Nombre}',{m.Precio});";
     con.Ejecutar(query);
 }