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()); } }
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")); } }