public async Task <IActionResult> Edit(int id, [Bind("erID,Name,Cost,InStock,pID")] EResin eResin) { if (id != eResin.erID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eResin); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EResinExists(eResin.erID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["pID"] = new SelectList(_context.Provisioners, "pID", "pID", eResin.pID); return(View(eResin)); }
public async Task <IActionResult> Create([Bind("erID,Name,Cost,InStock,pID")] EResin eResin) { if (ModelState.IsValid) { _context.Add(eResin); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["pID"] = new SelectList(_context.Provisioners, "pID", "pID", eResin.pID); return(View(eResin)); }