コード例 #1
0
        public void Execute(object parameter)
        {
            Сulinary_recipeEntities dbReciepe = new Сulinary_recipeEntities();
            DialogResultConverter   converter = new DialogResultConverter();

            if (MessageBox.Show("Ви справді хочете видалити цей рецепт?", VM.SelectedReciepe.ReciepeName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                ReciepeBookHelper.dbReciepe.Reciepe.Remove(VM.SelectedReciepe);
                ReciepeBookHelper.dbReciepe.SaveChanges();
            }
            VM.GetReciepes();
        }
コード例 #2
0
        public void Execute(object parameter)
        {
            Сulinary_recipeEntities dbReciepe = new Сulinary_recipeEntities();

            dbReciepe.Reciepe.Add(new Reciepe()
            {
                ReciepeName = VM.Name,
                CuisineId   = VM.SelectedCuisine.Id,
                PhotoPath   = VM.PhotoPath,
                TypeId      = VM.SelectedReciepetype.Id,
                CookingTime = VM.Cookingtime,
                Calories    = VM.Calories,
                Rating      = VM.Raiting,
                Ingredients = VM.Components,
                Instruction = VM.ReciepeText,
            });
            dbReciepe.SaveChanges();
            MessageBox.Show("Рецепт добавлений", "Новий рецепт", MessageBoxButton.OK, MessageBoxImage.Information);
        }