Example #1
0
        public IActionResult CreateRecipe(CreateRecipeViewModel vm)
        {
            var recipe = vm.Recipe;

            recipe.CreatedAt = DateTime.Now;
            recipe.UserId    = userManager.GetUserId(User);

            recipeService.CreateOrUpdateRecipe(recipe);
            recipeService.AddIngredientsToRecipe(vm.ChosenIngredients, recipe.Id);

            return(Json(recipe.Id));
        }