public async Task <IActionResult> AddRecipe(RecipeViewModel recipe) { UserDto currentUser = HttpContext.Session.Get <UserDto>("User"); var recipeIdResult = await _recipesLogic.AddRecipe(new RecipeDto { Name = recipe.Name, Instructions = recipe.Instructions, UserId = currentUser.ID, Ingredients = recipe.Ingredients.Select(i => new IngredientDto { Name = i.Name, Quantity = i.Quantity }).ToList() }); return(Json(recipeIdResult)); }