public ActionResult Edit(int id) { IngredientVM model = ingredientProcessor.Get(id).DTOToViewModel(MapIngredient); sessionManager.SetItem(new ItemInfo() { Name = model.Name }); return(View(model)); }
public ActionResult AddIngredient(int ingredientId) { var rawIngredient = ingredientProcessor.Get(ingredientId).DTOToViewModel(MapIngredient); IngredientWithCountVM ingredient = new IngredientWithCountVM() { Callories = rawIngredient.Callories, Cost = rawIngredient.Cost, Description = rawIngredient.Description, Id = rawIngredient.Id, Name = rawIngredient.Name, Unit = rawIngredient.Unit, Count = 1 }; AddIngredientsToSession(new List <IngredientWithCountVM>() { ingredient }); return(RedirectToAction(nameof(Index))); }