public async Task <IActionResult> OnPost() { try { if (ModelState.IsValid == false) { return(Page()); } string cs = _config.GetConnectionString("Default"); fd.UpdateRestaurant(cs, UpdateRestaurantDetails); return(RedirectToPage("./View", new { @Id = UpdateRestaurantDetails.RestaurantID, @redirect = "update" })); } catch (Exception ex) { throw new Exception(ex.ToString()); } }