private void UpdateDish(GetReservedDish_Result oldDish, Dish newDish) { using(ProjetSGBDEntities context = new ProjetSGBDEntities()) { if(oldDish != null) { if((newDish != null) && (oldDish.DishId != newDish.DishId)) { context.DeleteReservedDish(oldDish.ClientId, oldDish.DishId, CurrentReception.ReceptionId, oldDish.ModifiedAt); context.NewReservedDish(CurrentClient.Id, newDish.DishId, CurrentReception.ReceptionId, CurrentClient.Acronym); } } else { if(newDish != null) { context.NewReservedDish(CurrentClient.Id, newDish.DishId, CurrentReception.ReceptionId, CurrentClient.Acronym); } } } }