public async Task <IActionResult> Edit(int id, [Bind("id,kid,locke,type,color,Material,address,status")] KeyReg keyReg) { if (id != keyReg.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(keyReg); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KeyRegExists(keyReg.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(keyReg)); }
public async Task <IActionResult> Create([Bind("id,kid,locke,type,color,Material,address,status")] KeyReg keyReg) { if (ModelState.IsValid) { _context.Add(keyReg); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(keyReg)); }