Exemple #1
0
        public IActionResult Delete(string id)
        {
            try
            {
                if (string.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("ViewAllFoods", "AllFlower"));
                }

                int result = _IFood.DeleteFood(Convert.ToInt32(id));

                if (result > 0)
                {
                    return(Json(data: true));
                }
                else
                {
                    return(Json(data: false));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public IActionResult Delete(int id)
        {
            var categoryId = _foodService.GetById(id).CategoryId;

            _foodService.DeleteFood(id);

            return(RedirectToAction("Topic", "Category", new { id = categoryId, searchQuery = "" }));
        }