// GET: IngredientViewModels public ActionResult Index() { var ingredientsList = _ingredientManager.GetAll(); var listOfIngredientsViewModels = _mapper.Map <IList <IngredientViewModel> >(ingredientsList); return(View(listOfIngredientsViewModels)); }
// GET: Recipe/Create public ActionResult Create() { var newRecipe = new RecipeIngredientsViewModel(); var dropDownListOfIngredientModels = _ingredientManager.GetAll(); var dropDownListOfIngrediens = _mapper.Map <List <IngredientViewModel> >(dropDownListOfIngredientModels); newRecipe.IngredientsDropDownList = dropDownListOfIngrediens; return(View(newRecipe)); }
public IActionResult GetAll() { try { return(Ok(_ingredientManager.GetAll())); } catch (Exception ex) { return(BadRequest(ex.Message)); } }