Esempio n. 1
0
        public async Task <IActionResult> DeleteIngredient(int id)
        {
            if (await _ingredientServices.IsIngredientUsedAsync(id))
            {
                ModelState.AddModelError(string.Empty, "The ingredient is currently being used in a cokctail and thus cannot be deleted.");
                return(View("ManageIngredients"));
            }
            await _ingredientServices.DeleteAsync(id);

            return(View("ManageIngredients"));
        }