Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            IngredientVM model = ingredientProcessor.Get(id).DTOToViewModel(MapIngredient);

            sessionManager.SetItem(new ItemInfo()
            {
                Name = model.Name
            });
            return(View(model));
        }
Esempio n. 2
0
        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)));
        }