public async Task <IActionResult> UpdateIngredient(Guid id) { var ingredientToUpdate = await ingredientServices.GetIngredient(id); var ingredientToUpdateVM = ingredientToUpdate.GetViewModel(); return(View(ingredientToUpdateVM)); }
public async Task <IActionResult> RemoveIngredient(Guid cocktailId, Guid ingredientId) { try { var ingredient = await ingredientServices.GetIngredient(ingredientId); var cocktail = await cocktailServices.GetCocktail(cocktailId); await cocktailServices.RemoveIngredientFromCocktail(cocktail.Name, ingredient.Name); this.toast.AddSuccessToastMessage(Exceptions.SuccessfullyDeleted); return(RedirectToAction("ListCocktails", "Cocktail")); } catch (Exception) { this.toast.AddErrorToastMessage(Exceptions.SomethingWentWrong); return(RedirectToAction("ListCocktails", new { Area = "" })); } }
public async Task <IActionResult> IngredientDetails(Guid id) { if (id == null) { return(NotFound()); } try { var ingredient = await ingredientServices.GetIngredient(id); return(View(ingredient)); } catch (Exception) { this.toast.AddWarningToastMessage("Something went wrong!"); return(RedirectToAction("ListIngredients")); } }