示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("IngredientID,Amount,IngredientName,BrewID")] 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(nameof(Index)));
            }
            ViewData["BrewID"] = new SelectList(_context.Brew, "BrewID", "BrewID", ingredient.BrewID);
            return(View(ingredient));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("NoteID,DateLogged,NoteDescription,BrewID")] Note note)
        {
            if (id != note.NoteID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(note);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NoteExists(note.NoteID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrewID"] = new SelectList(_context.Brew, "BrewID", "BrewID", note.BrewID);
            return(View(note));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("StepID,StepNote,BrewID")] 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(nameof(Index)));
            }
            ViewData["BrewID"] = new SelectList(_context.Brew, "BrewID", "Description", step.BrewID);
            return(View(step));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("BrewID,CreateDate,Name,Description,Style,Yield,OriginalGravity,FinalGravity,ABV")] Brew brew)
        {
            if (id != brew.BrewID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(brew);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BrewExists(brew.BrewID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(brew));
        }