Ejemplo n.º 1
0
        private void editIngredient_Click(object sender, EventArgs e)
        {
            var selectedIngredientRow = ingredientsDataGrid.SelectedRows[0];
            var selectedIngredient    = ((Ingredient)selectedIngredientRow.DataBoundItem);

            selectedIngredient.Units = new UnitRepository(_connectionString).GetAll();
            var dialogResult = new AddOrEditIngredientForm(selectedIngredient, _connectionString).ShowDialog(this);

            if (dialogResult == DialogResult.OK)
            {
                FillOrRefreshGridOfIngredients();
            }
        }
Ejemplo n.º 2
0
        private void addIngredient_Click(object sender, EventArgs e)
        {
            var ingredient = new Ingredient();

            ingredient.Units = new UnitRepository(_connectionString).GetAll();

            var dialogResult = new AddOrEditIngredientForm(ingredient, _connectionString).ShowDialog(this);

            if (dialogResult == DialogResult.OK)
            {
                FillOrRefreshGridOfIngredients();
            }
        }