void mi_Click(object sender, RoutedEventArgs e)
 {
     MenuItem mi = sender as MenuItem;
     ContextMenu cm = mi.Parent as ContextMenu;
     TextBlock curTvi = (TextBlock)cm.PlacementTarget;
     string groupName = curTvi.Text;
     int mealId = DbController.AddMeal("Новое блюдо", groupName);
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     viewModel = new MenuBookViewModel();
     TreeMeals.DataContext = viewModel;
 }
 void mi_Corr(object sender, RoutedEventArgs e)
 {
     MenuItem mi = sender as MenuItem;
     ContextMenu cm = mi.Parent as ContextMenu;
     TextBlock curTvi = (TextBlock)cm.PlacementTarget;
     int mealId;
     using (Model1Container db = new Model1Container())
     {
         mealId = (from meal in db.Meal
                   where meal.Name.Equals(curTvi.Text)
                   select meal.MealPK).FirstOrDefault();
     }
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     viewModel = new MenuBookViewModel();
     TreeMeals.DataContext = viewModel;
 }
 void add_Click(object sender, RoutedEventArgs e)
 {
     string groupName = "Супы";
     int mealId = DbController.AddMeal("Новое блюдо", groupName);
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     bookViewModel = new MenuBookViewModel();
     MBV1.TreeMeals.DataContext = bookViewModel;
 }
 public void ViewMealMethod()
 {
     AddMealView am = new AddMealView(1);
     am.ShowDialog();
 }