public IActionResult OnPost(int restaurantId)
        {
            var restaurant = data.Delete(restaurantId);

            data.Commit();
            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            TempData["Message"] = $"{restaurant.Name} has been deleted.";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 2
0
        public IActionResult OnPost(int restaurantId)
        {
            Restaurant restaurant = restaurantData.Delete(restaurantId); // Delete function is here

            restaurantData.Commit();
            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 3
0
        public IActionResult OnPost(int id)
        {
            var Restaurant = _restaurantData.Delete(id);

            _restaurantData.Save();
            if (Restaurant == null)
            {
                return(RedirectToPage("/.NotFound"));
            }


            return(RedirectToPage("./List"));
        }
Exemplo n.º 4
0
        public IActionResult OnPost(int restaurantId)
        {
            var res = restaurantData.Delete(restaurantId);

            restaurantData.Commit();

            if (res == null)
            {
                return(RedirectToPage());
            }
            TempData["Message"] = $"{res.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 5
0
        public IActionResult OnPost(int restaurantId)
        {
            var temp = restaurantData.Delete(restaurantId);

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

            restaurantData.Commit();
            TempData["TempMessage"] = "The Object is deleted!";
            return(RedirectToPage("./List"));
        }
        public IActionResult Delete(Restaurant model)
        {
            var temp = restaurantData.Delete(model.Id);

            if (temp == null)
            {
                return(View("NotFound"));
            }

            restaurantData.Commit();
            TempData["Message"] = "The Object is deleted!";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        public IActionResult OnPost(int restId)
        {
            Restaurant = _restaurantData.Delete(restId);
            _restaurantData.Commit();

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

            TempData["Message"] = $"{Restaurant.Name} was deleted successfully.";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 8
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

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

            restaurantData.Commit();
            TempData["RestaurantName"] = restaurant.Name;
            return(RedirectToPage("./List"));
        }
Exemplo n.º 9
0
 public IActionResult DeletePost(int id)
 {
     try
     {
         _resto.Delete(id);
         TempData["pesan"] = "Data restaurant berhasil didelete";
         return(RedirectToAction(nameof(GetData)));
     }
     catch (System.Exception)
     {
         return(View());
     }
 }
Exemplo n.º 10
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.GetById(restaurantId);

            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            restaurantData.Delete(restaurantId);
            restaurantData.Commit();
            TempData["Message"] = $"{restaurant.Name} is deleted";
            return(RedirectToPage("./List"));
        }
        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("./Index"));
        }
Exemplo n.º 12
0
        public IActionResult OnPost(int restaurantId)
        {
            var deleted = _restaurantData.Delete(restaurantId);

            _restaurantData.Commit();

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

            TempData["Message"] = $"Restaurant {deleted.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 13
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();

            if (restaurant == null)
            {
                return(RedirectToPage(config.PageNotFound));
            }

            TempData[config.MESSAGE] = $"{restaurant.Name} deleted";
            return(RedirectToPage(config.ListPage));
        }
Exemplo n.º 14
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = _restaurantData.Delete(restaurantId);

            _restaurantData.Commit();

            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            //Message which says that restaurant is deleted.
            TempData["Message"] = $"{restaurant.Name} deleted!";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 15
0
        public IActionResult OnPost(int restaurantId)
        {
            Restaurant = restaurantData.Delete(restaurantId);

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

            restaurantData.Commit();

            TempData["Message"] = "${Restaurant.Name} was deleted!";
            return(RedirectToPage("./List"));
        }
        public IActionResult Delete(int id)
        {
            var restaurant = _restaurantData.GetRestaurantById(id);

            if (restaurant == null)
            {
                return(NotFound());
            }

            _restaurantData.Delete(id);
            _restaurantData.Commit();

            return(Ok(restaurant));
        }
Exemplo n.º 17
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         db.Delete(id);
         TempData["Mensaje"] = "Borrado correctamente";
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 18
0
        //In here where you want to do the actual deleting.
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();
            // the restaurant should already be deleted, but if it's still there for some reason
            // just go ahead and delete it.
            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 19
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();
            if (Restaurant == null)
            {
                return(RedirectToPage("./PageNotFound"));
            }
            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));

            // added some comments on upload
        }
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            if (restaurant is null)
            {
                return(RedirectToPage("/Error"));
            }
            else
            {
                restaurantData.Commit();
                TempData["Message"] = $"{restaurant.Name} deleted.";
                return(RedirectToPage("./List"));
            }
        }
Exemplo n.º 21
0
        public IActionResult OnPost(int restaurantId)
        {
            //return the delete restaurant to use later
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();

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

            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 22
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();

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

            /* what is this $ sign for */
            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 23
0
        public IActionResult Delete(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var restaurant = data.GetById(id);

            if (restaurant == null)
            {
                return(NotFound());
            }
            data.Delete(id);
            return(NoContent());
        }
        public async Task <ActionResult> DeletePost(int id)
        {
            try
            {
                await _resto.Delete(id.ToString());

                TempData["pesan"] = "<div class='alert alert-success'>Data berhasil didelete</div>";
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                ViewData["pesan"] = $"<div class='alert alert-danger'>data gagal diupdate {ex.Message}</div>";
                return(View());
            }
        }
Exemplo n.º 25
0
        public IActionResult Delete(int id)
        {
            var resto = _restaurantData.Get(id);

            if (ModelState.IsValid)
            {
                _restaurantData.Delete(id);
                return(RedirectToAction("Index", "Home")); // TODO :fix redirection to details
            }

            if (resto == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Exemplo n.º 26
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = data.GetById(restaurantId);

            if (restaurant == null)
            {
                return(RedirectToPage("NotFound"));
            }
            restaurant = data.Delete(restaurant.Id);
            data.Commit();
            if (restaurant == null)
            {
                return(RedirectToPage("NotFound"));
            }
            TempData["Message"] = $"The restaurant {restaurant.Name} deleted Succesfully";
            return(RedirectToPage("List"));
        }
Exemplo n.º 27
0
        public IActionResult Delete(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var deletedRestaurant = restaurantData.Delete(id);

            if (deletedRestaurant == null)
            {
                return(NotFound());
            }

            restaurantData.Commit();

            return(Ok());
        }
Exemplo n.º 28
0
        // REMEMBER! We never want to modify data during GET, so we create POST here.
        // And after delete, we will redirect and issue GET request for some
        // other page so user is not sitting on top of result from a POST.  That is
        // why we return some IActionResult
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = restaurantData.Delete(restaurantId);

            restaurantData.Commit();

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

            // we dont want this page to render and show result based on POST but
            // redirect to list of restaurants page, so this issues another GET
            // request to show all restaurants.  Put user friendly message in
            // TempData so user is notified that delete succeeded.
            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Exemplo n.º 29
0
        public IActionResult OnPost(int restaurantId)
        {
            try
            {
                var restaurant = restaurantData.Delete(restaurantId);
                restaurantData.Commit();

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

                TempData["Message"] = $"{restaurant.Name} deleted !!";
                return(RedirectToPage("./List"));
            }
            catch (Exception ex)
            {
                throw new Exception($"Some error has occuured : {guidService.GetGuid()}");
            }
        }
Exemplo n.º 30
0
 public ActionResult Delete(int id, FormCollection form)
 {
     db.Delete(id);
     return(RedirectToAction("Index"));
 }