Ejemplo n.º 1
0
        private void comboBoxProducts_SelectionChangeCommitted(object sender, EventArgs e)
        {
            int selectedProductId = (int)comboBoxProducts.SelectedValue;
            var product           = productOperations.GetProductById(selectedProductId);

            selectedProduct         = product;
            textBoxUpdProdName.Text = product.Name;
            textBoxUpdProdDesc.Text = product.Description;
            textBoxUpdPrice.Text    = product.Price.ToString();

            //seçilen ürünün kategorisini de değiştirebilmek için yeni bir comboBox
            comboBoxUpdCtOfPro.DataSource    = db.Categories.ToList();
            comboBoxUpdCtOfPro.DisplayMember = "Name";
            comboBoxUpdCtOfPro.ValueMember   = "Id";

            comboBoxUpdCtOfPro.SelectedValue = product.CategoryId;
        }