Exemplo n.º 1
0
 public IActionResult OnGet(int restaurantId)
 {
     Restaurant = restaurantData.GetById(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
Exemplo n.º 2
0
        //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"));
            }
        }