private void buttonSave_Click(object sender, EventArgs e) { FeelingType feelingtype = (FeelingType)comboBoxFeeling.SelectedItem; if(CurrentDish != null && feelingtype != null) { try { using(ProjetSGBDEntities context = new ProjetSGBDEntities()) { context.UpdateWishedDish(CurrentClient.Id, CurrentDish.DishId, feelingtype.Id, CurrentDish.ModifiedAt, CurrentClient.Acronym); } } catch(Exception ex) { ModelError modelError = new ModelError(ex); if(modelError.Number == ModelError.DATA_NOT_UP_TO_DATE) { MessageBox.Show(modelError.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDishWish(CurrentDish.DishId); DialogResult = DialogResult.None; } else { MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }