public async Task <IActionResult> Edit(int id, [Bind("IngredientID,item,ItemID,RecipeID,Quantity,Units")] Ingredient ingredient)
        {
            if (id != ingredient.IngredientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ingredient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IngredientExists(ingredient.IngredientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(ingredient));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("StepID,RecipeID,Description,Order")] Step step)
        {
            if (id != step.StepID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(step);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StepExists(step.StepID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(step));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("RecipeID,Notes,Servings")] Recipe recipe)
        {
            if (id != recipe.RecipeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(recipe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecipeExists(recipe.RecipeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(recipe));
        }