public async Task <IActionResult> OnPostAsync(int?id) { if (!ModelState.IsValid) { return(Page()); } commentToAdd.PostPostId = id.Value; var result = await pcc.SubmitCommentAsync(commentToAdd); if (result == null) { return(RedirectToAction("Error")); } return(RedirectToPage("/Posts/Index")); }