public IActionResult OnGet(int restaurantId)
 {
     Restaurant = restaurantData.GetByID(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
Esempio n. 2
0
 // Rename from void to IActionResult
 public IActionResult OnGet(int restaurantId)
 {
     Restaurant = restaurantData.GetByID(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound")); // Redirect if null
     }
     return(Page());                           // Return the page that is built in the cshtml file
 }
Esempio n. 3
0
 public ActionResult OnGet(int RestaurantId)
 // Getting the Restaurant ID from the Route
 {
     restaurant = restaurantData.GetByID(RestaurantId);
     if (restaurant == null)
     {
         return(RedirectToAction("./NotFound", RestaurantId));
     }
     return(Page());
 }
 public IActionResult OnGet(int RestaurantID)
 {
     //Restaurant = new Restaurant();
     Restaurant = restaurantData.GetByID(RestaurantID);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
Esempio n. 5
0
 public IActionResult OnGet(int?restaurantId)
 {
     Cuisines = htmlHelper.GetEnumSelectList <CuisineType>();
     if (restaurantId.HasValue)
     {
         Restaurant = restaurantData.GetByID(restaurantId.Value);
     }
     else
     {
         Restaurant = new Restaurant();
     }
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
Esempio n. 6
0
        // OnGet is when the page is requested, the id is in the URL, the restaurant id is passed as an argument by the cshtml first line
        public IActionResult OnGet(int?restaurantId)
        {
            Cuisines = htmlHelper.GetEnumSelectList <CuisineType>(); // Data binding for the drop down select, look at the htmlHelper that populates the variable

            // If null, add new restaurant, otherwise edit existing restaurant
            if (restaurantId.HasValue)
            {
                Restaurant = restaurantData.GetByID(restaurantId.Value);
            }
            else
            {
                Restaurant = new Restaurant();
            }

            if (Restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            return(Page());
        }
Esempio n. 7
0
 public void OnGet(int RestaurantId)
 {
     restaurant = irestaurantData.GetByID(RestaurantId);
     // 1-With the ID passed from the route, get the single Restaurant to be deleted.
     // 2-Show the Single Restaurant
 }
Esempio n. 8
0
        public IActionResult Details(int id)
        {
            var model = _resto.GetByID(id);

            return(View(model));
        }