Beispiel #1
0
 public IActionResult OnGet(int restaurantId)
 {
     // Restaurant = new demoOdeToFood.core.Restaurant();
     //Restaurant.id = restaurantId;
     Restaurant = restaurantData.GetById(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./Not Found"));
     }
     return(Page());
 }
Beispiel #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Restaurant = await _context.Restaurants.FirstOrDefaultAsync(m => m.id == id);

            if (Restaurant == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Restaurant = await _context.Restaurants.FindAsync(id);

            if (Restaurant != null)
            {
                _context.Restaurants.Remove(Restaurant);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
 public IActionResult OnGet(int?restaurantId)
 {
     Cuisine = htmlHelper.GetEnumSelectList <CuisineType>();
     if (restaurantId.HasValue)
     {
         Restaurant = restaurantData.GetById(restaurantId.Value);
     }
     else
     {
         Restaurant = new demoOdeToFood.core.Restaurant();
     }
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }