caso de producto sin imagen
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"ExpandedNodes": [
|
||||
""
|
||||
"",
|
||||
"\\database",
|
||||
"\\database\\modelos"
|
||||
],
|
||||
"SelectedNode": "\\compabetov2.sln",
|
||||
"SelectedNode": "\\database\\DAO.cs",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
Binary file not shown.
+8
-3
@@ -109,8 +109,13 @@ namespace compabetov2.database
|
||||
|
||||
string sql = "INSERT INTO Producto (nombre, descripcion, precio, img, stock, idcategoria) "+
|
||||
"VALUES (@nombre, @descripcion, @precio, @stock, @img, @idcategoria)";
|
||||
|
||||
string rutaDestino = guardarImg(producto.img);
|
||||
|
||||
if (!producto.img.Equals(""))
|
||||
{
|
||||
string rutaDestino = guardarImg(producto.img);
|
||||
producto.img = rutaDestino;
|
||||
}
|
||||
|
||||
|
||||
using (SQLiteCommand command = new SQLiteCommand(sql, conexion))
|
||||
{
|
||||
@@ -118,7 +123,7 @@ namespace compabetov2.database
|
||||
command.Parameters.AddWithValue("@descripcion", producto.descripcion);
|
||||
command.Parameters.AddWithValue("@precio", producto.precion);
|
||||
command.Parameters.AddWithValue("@stock", producto.stock);
|
||||
command.Parameters.AddWithValue("@img", rutaDestino);
|
||||
command.Parameters.AddWithValue("@img", producto.img);
|
||||
command.Parameters.AddWithValue("@idcategoria", producto.categoria.idCategoria);
|
||||
int filasAfectadas = command.ExecuteNonQuery();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user