Exemplo n.º 1
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = RestaurantData.Delete(restaurantId);

            RestaurantData.Commit();

            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
 public ActionResult DeletePost(int id)
 {
     try
     {
         _resto.Delete(id);
         TempData["Pesan"] = $"<span class='alert alert-success'>Data id {id} berhasil didelete</span>";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewData["Pesan"] = $"<span cl>Data gagal didelete {ex.Message}</span>";
         return(View());
     }
 }
Exemplo n.º 3
0
 public IActionResult OnPost(int restaurantId)
 {
     Restaurant = restaurantData.Delete(restaurantId);
     restaurantData.Commit();
     if (Restaurant == null)
     {
         return(RedirectToPage("./notfound"));
     }
     else
     {
         TempData["Message"] = $"{ Restaurant.Name } is deleted";
         return(RedirectToPage("./List"));
     }
 }