コード例 #1
0
        public IActionResult Create(CreateCommentViewModel createComment)
        {
            ViewData["recipeId"] = createComment.RecipeId;
            if (!ModelState.IsValid)
            {
                return(View(createComment));
            }

            _recipeService.AddComment(createComment);

            return(RedirectToAction("Details", "Recipe", new { id = createComment.RecipeId }));
        }
コード例 #2
0
        public IActionResult AddRecipieComment([FromBody] RecipeComment recipeComment)
        {
            var response = _RecipeService.AddComment(recipeComment).Result;

            return(new OkObjectResult(response));
        }