insert y select de productos agregada
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SQLite;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -14,5 +15,37 @@ namespace compabetov2.database
|
||||
{
|
||||
return DAO.iniciarSesionDAO(usuario.nombreUsuario, usuario.contra);
|
||||
}
|
||||
|
||||
public static List<Producto> conseguirProductos()
|
||||
{
|
||||
List<Producto> productos = new List<Producto>();
|
||||
|
||||
SQLiteDataReader reader = DAO.conseguirProductosDAO();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
Categoria categoria = new Categoria(
|
||||
(int)reader["idcategoria"],
|
||||
reader["nombre"].ToString(),
|
||||
reader["descripcion"].ToString());
|
||||
|
||||
Producto producto = new Producto(
|
||||
reader["nombre"].ToString(),
|
||||
reader["descripcion"].ToString(),
|
||||
(decimal)reader["precio"],
|
||||
categoria,
|
||||
(int)reader["stock"],
|
||||
(int)reader["idproducto"]);
|
||||
|
||||
productos.Add(producto);
|
||||
}
|
||||
|
||||
return productos;
|
||||
}
|
||||
|
||||
public static bool insertarProducto(Producto producto)
|
||||
{
|
||||
return DAO.insertarProductoDAO(producto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user