コード例 #1
0
        public IActionResult Delete(int id)
        {
            Dish retrievedDish = dbContext.Dishes.FirstOrDefault(dish => dish.DishID == id);

            if (retrievedDish != null)
            {
                dbContext.Remove(retrievedDish);
                dbContext.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("One"));
            }
        }