public IActionResult OnGet(int restaurantId) { Restaurant = restaurantData.GetById(restaurantId); if (Restaurant == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
//responds to an onGet method //int? is nullable public IActionResult OnGet(int?id) { Cuisines = HtmlHelper.GetEnumSelectList <CuisineType>(); if (id.HasValue) { this.Restaurant = RestaurantData.GetById(id.Value); } else { Restaurant = new Restaurant(); } if (this.Restaurant != null) { return(Page()); } else { return(RedirectToPage("./NotFound")); } }