Ejemplo n.º 1
0
        public async Task <IActionResult> CommentLocation(CommentInputModel inputModel)
        {
            if (!ModelState.IsValid)
            {
                TempData["commentSuccess"] = false;

                return(LocalRedirect($"/Locations/{inputModel.LocationId}#commentSuccess"));
            }

            inputModel.UserId = userManager.GetUserId(User);

            int result = await commentsService.AddLocationCommentAsync(inputModel);

            if (result > 0)
            {
                TempData["commentSuccess"] = true;
            }

            return(LocalRedirect($"/Locations/{inputModel.LocationId}#commentSuccess"));
        }