public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Comment = await _commentService.GetCommentById(id); if (Comment == null) { return(NotFound()); } return(Page()); }
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 })); }