public IActionResult Delete(int id)
        {
            var restaurant = new Restaurant {
                Id = id
            };

            _restaurantData.DeleteRestaurant(restaurant);

            return(RedirectToAction("Index", "Home"));
        }
 public IActionResult OnPost(int restid)
 {
     Restaurant = restaurantData.DeleteRestaurant(restid);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     TempData["Message"] = "Deleted Successfully";
     return(RedirectToPage("./List"));
 }
Example #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"));
 }
Example #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();
        }
Example #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"));
        }
Example #6
0
 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"));
 }
        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"));
        }
        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));
        }
        public async Task <IActionResult> Delete(RestaurantModel restaurantModel)
        {
            await _restaurantData.DeleteRestaurant(restaurantModel.Id);

            return(RedirectToAction("Index"));
        }
 public IActionResult OnPost()
 {
     _restaurantData.DeleteRestaurant(Restaurant);
     return(RedirectToPage("./List"));
 }
 public ActionResult Delete(int id, FormCollection form)
 {
     database.DeleteRestaurant(id);
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> OnPost()
        {
            await _restaurantData.DeleteRestaurant(Id);

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

            return(Ok());
        }