Esempio n. 1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Comment = await _commentService.GetCommentById(id);

            if (Comment == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Comment = await _commentService.GetCommentById(id);

            var productId = Comment.ProductId;

            if (Comment != null)
            {
                await _commentService.RemoveComment(id);
            }

            return(RedirectToPage("./Index", new { productId = productId }));
        }