public async Task <IActionResult> OnPost() { if (yourReview == null) { return(RedirectToPage("../Index")); } var checkReview = reviewdb.GetById(yourReview.OrderId, yourReview.GameId, yourReview.PlatformId); if (checkReview == null) { reviewdb.Add(yourReview); await reviewdb.CommitAsync(); } else { checkReview.Recommended = yourReview.Recommended; checkReview.Review_Detail = yourReview.Review_Detail; reviewdb.Update(checkReview); await reviewdb.CommitAsync(); } return(RedirectToPage("./Detail", new { id = yourReview.GameId })); }