コード例 #1
0
        public IActionResult Delete(int id)
        {
            var restaurant = new Restaurant {
                Id = id
            };

            _restaurantData.DeleteRestaurant(restaurant);

            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
 public IActionResult OnPost(int restid)
 {
     Restaurant = restaurantData.DeleteRestaurant(restid);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     TempData["Message"] = "Deleted Successfully";
     return(RedirectToPage("./List"));
 }
コード例 #3
0
 public IActionResult OnPost(int restaurantId)
 {
     Restaurant = restaurantData.DeleteRestaurant(restaurantId);
     restaurantData.Commit();
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     TempData["Message"] = $"{Restaurant.Name} deleted!";
     return(RedirectToPage("./List"));
 }
コード例 #4
0
        public void OnPost(int id)
        {
            Restaurant = _restaurantData.GetRestaurantById(id);
            if (Restaurant == null)
            {
                RedirectToPage("../NotFound");
            }

            TempData["Message"] = Restaurant.Name + " deleted.";
            Restaurant          = _restaurantData.DeleteRestaurant(id);
            _restaurantData.Commit();
        }
コード例 #5
0
        public IActionResult OnPost(string restaurantId)
        {
            //var restaurant =
            restaurantData.DeleteRestaurant(restaurantId);
            //restaurantData.Commit();

            //if (restaurant == null)
            //{
            //    return RedirectToPage("./NotFound");
            //}
            //TempData["Message"] = $"{restaurant.Name} deleted.";
            return(RedirectToPage("./List"));
        }
コード例 #6
0
ファイル: Delete.cshtml.cs プロジェクト: bjorkblom/.NETCORE
 public IActionResult OnPost()
 {
     if (Restaurant != null)
     {
         RestaurantData.DeleteRestaurant(Restaurant.Id);
         RestaurantData.Commit();
         TempData["Message"] = $"Restaurant {Restaurant.Name} deleted";
     }
     else
     {
         TempData["Message"] = $"Restaurant {Restaurant.Name} could not be deleted";
     }
     return(RedirectToPage("./List"));
 }
コード例 #7
0
        public IActionResult OnPost()
        {
            var restaurant = restaurantData.DeleteRestaurant(Id);

            restaurantData.Commit();

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

            TempData["Message"] = $"{restaurant.Name} deleted sucessfully!";
            return(RedirectToPage("./List"));
        }
コード例 #8
0
        public IActionResult DeleteRestaurants([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Restaurant restaurant = restaurantData.DeleteRestaurant(id);
            int        response   = restaurantData.Commit();

            if (restaurant == null)
            {
                return(NotFound());
            }
            return(Ok(restaurant));
        }
コード例 #9
0
        public async Task <IActionResult> Delete(RestaurantModel restaurantModel)
        {
            await _restaurantData.DeleteRestaurant(restaurantModel.Id);

            return(RedirectToAction("Index"));
        }
コード例 #10
0
 public IActionResult OnPost()
 {
     _restaurantData.DeleteRestaurant(Restaurant);
     return(RedirectToPage("./List"));
 }
コード例 #11
0
 public ActionResult Delete(int id, FormCollection form)
 {
     database.DeleteRestaurant(id);
     return(RedirectToAction("Index"));
 }
コード例 #12
0
        public async Task <IActionResult> OnPost()
        {
            await _restaurantData.DeleteRestaurant(Id);

            return(RedirectToPage("./ListRestaurants"));
        }
コード例 #13
0
        public async Task <IActionResult> Delete(int id)
        {
            await _restaurantData.DeleteRestaurant(id);

            return(Ok());
        }