private void BtnAddFood_Click(object sender, EventArgs e) { foodToAdd = new Food(); var foodForm = new FoodForm(foodToAdd); foodForm.FormClosed += FoodForm_FormClosed; foodForm.ShowDialog(); }
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); }