public IActionResult OnGet(int restaurantId)
 {
     Restaurant = restaurantData.GetRestaurantById(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
 public IActionResult OnPost(int restaurantId)
 {
     Restaurant = restaurantData.Delete(restaurantId);
     restaurantData.Commit();
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     TempData["Message"] = $"{ Restaurant.Name}  deleted !";
     return(RedirectToPage("./List"));
 }
Beispiel #3
0
 public IActionResult OnGet(int?restaurantId)
 {
     Cuisines = htmlHelper.GetEnumSelectList <CusineType>();
     if (restaurantId.HasValue)
     {
         Restaurant = restaurantData.GetRestaurantById(restaurantId.Value);
     }
     else
     {
         Restaurant = new Service.Restaurant();
     }
     if (Restaurant == null)
     {
         RedirectToPage("./NotFound");
     }
     return(Page());
 }