コード例 #1
0
        public ActionResult DeleteIngredient(int ingredientId, int mealId)
        {
            _ingredientServices.DeleteIngredient(ingredientId);

            var viewModel = GetMealModel(mealId);

            return(PartialView("IngredientsTable", viewModel));
        }
コード例 #2
0
        public async Task <IActionResult> DeleteIngredient(Guid id)
        {
            try
            {
                await ingredientServices.DeleteIngredient(id);

                this.toast.AddSuccessToastMessage(Exceptions.SuccessfullyDeleted);
                return(RedirectToAction("ListIngredients", "Ingredient"));
            }
            catch (Exception)
            {
                this.toast.AddErrorToastMessage(Exceptions.SomethingWentWrong);
                return(RedirectToAction("ListIngredients"));
            }
        }