Exemplo n.º 1
0
        public async Task <IActionResult> DeleteConfirmed(string id)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var name = await _ingredientServices.DeleteIngredientAsync(id);

                    _toast.AddInfoToastMessage($"Ingredient {name} was deleted!");
                }
                catch (Exception ex)
                {
                    _toast.AddErrorToastMessage(ex.Message);
                    ViewBag.ErrorTitle = "";
                    return(View("Error"));
                }
            }
            return(RedirectToAction(nameof(Index)));
        }