public async Task <IActionResult> Edit(int id, [Bind("RecipeID,RecipeName,StyleName,TargetGravity,MashingTemp,SuggestedFermTemp")] 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(nameof(Index))); } ViewData["StyleName"] = new SelectList(_context.Styles, "StyleName", "StyleName", recipe.StyleName); return(View(recipe)); }
public async Task <IActionResult> Edit(int id, [Bind("BeerID,RecipeName,RecipeID,ABV,BrewDate,RackDate,KegDate,InitalGravity,FinalGravity,Description,Active")] Beer beer) { if (id != beer.BeerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(beer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BeerExists(beer.BeerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RecipeID"] = new SelectList(_context.RecipeCatalog, "RecipeID", "RecipeID", beer.RecipeID); return(View(beer)); }
public async Task <IActionResult> Edit(int id, [Bind("FermenterID,Name,TargetTemp,BeerID,Address")] Fermenter fermenter) { if (id != fermenter.FermenterID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fermenter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FermenterExists(fermenter.FermenterID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Address"] = new SelectList(_context.Sensors, "Address", "Address", fermenter.Address); ViewData["BeerID"] = new SelectList(_context.BrewHistory, "BeerID", "BeerID", fermenter.BeerID); return(View(fermenter)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Amount")] GrainRecipeItem grainRecipeItem) { if (id != grainRecipeItem.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(grainRecipeItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GrainRecipeItemExists(grainRecipeItem.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(grainRecipeItem)); }