示例#1
0
        private void BtnAddFood_Click(object sender, EventArgs e)
        {
            foodToAdd = new Food();
            var foodForm = new FoodForm(foodToAdd);

            foodForm.FormClosed += FoodForm_FormClosed;

            foodForm.ShowDialog();
        }
示例#2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            var dataRowView = (DataRowView)foodBindingSource.Current;
            var food        = foodService.GetForRow(dataRowView.Row);

            var foodForm = new FoodForm(food);

            foodForm.ShowDialog();

            foodService.Update(dataRowView.Row, food);
        }