public IActionResult OnPost() { if (!ModelState.IsValid) { this.Categories = HtmlHelper.GetEnumSelectList <Category> (); return(Page()); } if (Book.ISN > 0) { BookData.Update(Book); } else { BookData.Add(Book); } BookData.Commit(); TempData["Message"] = "Book Saved"; return(RedirectToPage("./Detail", new { isn = Book.ISN })); }