Ejemplo n.º 1
0
        public ActionResult Edit(int editId, SupplyListAndSupplyViewModel PostSupply)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Edit"));
            }

            var ingredientNum      = int.Parse(PostSupply.PostIngredient);
            var selectedIngredient = MealHelper.GetAllIngredients().Where(x => x.Id == ingredientNum).FirstOrDefault();

            PostSupply.Supply.Ingredient = selectedIngredient;

            SupplyHelper.UpdateSupply(editId, PostSupply.Supply);

            return(RedirectToAction("Index"));
        }