public async Task <IActionResult> Edit(int id, [Bind("Id,Unit,Quantity")] Amount amount) { if (id != amount.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(amount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AmountExists(amount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(amount)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Variety variety) { if (id != variety.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(variety); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VarietyExists(variety.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(variety)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,RecipeCategory")] Recipe recipe) { if (id != recipe.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(recipe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecipeExists(recipe.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(recipe)); }