protected void buttonSubmit_Click(Object sender, EventArgs e) { bool favorito = ShowAssumptions.SelectedValue == "favorito" ? true : false; LogicaNegocio.Instance.addProduct(int.Parse(cantidadTb.Text), nombreTb.Text, double.Parse(precioUTb.Text), favorito); ProductFavorito.DataSource = LogicaNegocio.Instance.lFavorito.ToList(); ProductFavorito.DataBind(); ProductCarrito.DataSource = LogicaNegocio.Instance.lCarrito.ToList(); ProductCarrito.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ProductFavorito.DataSource = LogicaNegocio.Instance.lFavorito.ToList(); ProductFavorito.DataBind(); ProductCarrito.DataSource = LogicaNegocio.Instance.lCarrito.ToList(); ProductCarrito.DataBind(); if (!Page.IsPostBack) { List <string> list = new List <string>() { "favorito", "carrito" }; ShowAssumptions.DataSource = list; ShowAssumptions.DataBind(); } }