Example #1
0
        public IActionResult Create(CreateRecipeViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            _repository.AddRecipe(viewModel);
            return RedirectToAction("published", "Recipes");
        }
        public void AddRecipe(CreateRecipeViewModel viewModel)
        {
            var recipe = new Recipe();

            recipe.Name        = viewModel.Name;
            recipe.Age         = viewModel.Age;
            recipe.Email       = viewModel.Email;
            recipe.NameOfPlate = viewModel.NameOfPlate;
            recipe.Ingredients = viewModel.Ingredients;
            recipe.HowToDo     = viewModel.HowToDo;
        }
 public void AddRecipe(CreateRecipeViewModel viewModel)
 {
     var recipe = new Recipe();
     recipe.Name = viewModel.Name;
     recipe.Age = viewModel.Age;
     recipe.Email = viewModel.Email;
     recipe.NameOfPlate = viewModel.NameOfPlate;
     recipe.Ingredients = viewModel.Ingredients;
     recipe.HowToDo = viewModel.HowToDo;
     
 }
Example #4
0
        public void AddRecipe(CreateRecipeViewModel viewModel)
        {
            var recipe = new Recipe();
            recipe.Name = viewModel.Name;
            recipe.Age = viewModel.Age;
            recipe.Email = viewModel.Email;
            recipe.NameOfPlate = viewModel.NameOfPlate;
            recipe.Ingredients = viewModel.Ingredients;
            recipe.HowToDo = viewModel.HowToDo;

            _context.Recipes.Add(recipe);
            _context.SaveChanges();
        }
Example #5
0
        public void AddRecipe(CreateRecipeViewModel viewModel)
        {
            var recipe = new Recipe();

            recipe.Name        = viewModel.Name;
            recipe.Age         = viewModel.Age;
            recipe.Email       = viewModel.Email;
            recipe.NameOfPlate = viewModel.NameOfPlate;
            recipe.Ingredients = viewModel.Ingredients;
            recipe.HowToDo     = viewModel.HowToDo;

            _context.Recipes.Add(recipe);
            _context.SaveChanges();
        }