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)); }
public async Task <IActionResult> Create([Bind("ID,Amount")] GrainRecipeItem grainRecipeItem) { if (ModelState.IsValid) { _context.Add(grainRecipeItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(grainRecipeItem)); }