private Producto ConstruirProducto(SqlDataReader reader) { return(new Producto() { ProductoId = reader.GetInt32(0), Descripcion = reader.GetString(1), Marca = repositorioMarcas.GetMarcaPorId(reader.GetInt32(2)), Categoria = repositorioCategorias.GetCategoriaPorId(reader.GetInt32(3)), PrecioUnitario = reader.GetDecimal(4), Stock = reader.GetDecimal(5), Suspendido = reader.GetBoolean(6) }); }
private Producto ConstruirProductoTotal(SqlDataReader reader) { Producto producto = new Producto(); producto.ProductoId = reader.GetInt32(0); producto.Descripcion = reader.GetString(1); producto.Marca = _repositorioMarcas.GetMarcaPorId(reader.GetInt32(2)); producto.Categoria = _repositorioCategorias.GetCategoriaPorId(reader.GetInt32(3)); producto.PrecioUnitario = reader.GetDecimal(4); producto.Stock = reader.GetDecimal(5); producto.CodigoBarra = reader[6] != DBNull.Value?reader.GetString(6):null; producto.Medida = _repositorioMedidas.GetMedidaPorId(reader.GetInt32(7)); producto.Imagen = reader[8] != DBNull.Value?reader.GetString(8):null; producto.Suspendido = reader.GetBoolean(9); return(producto); }
public Marca GetMarcaPorId(int id) { try { _conexion = new ConexionBd(); _repositorio = new RepositorioMarcas(_conexion.AbrirConexion()); var marca = _repositorio.GetMarcaPorId(id); _conexion.CerrarConexion(); return(marca); } catch (Exception e) { throw new Exception(e.Message); } }