public async Task <IActionResult> Edit(int id, [Bind("CardId,ApplicationUserModelId,LastScanDate")] NfcCardModel nfcCardModel) { if (id != nfcCardModel.CardId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nfcCardModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NfcCardModelExists(nfcCardModel.CardId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserModelId"] = new SelectList(_context.Users, "Id", "Id", nfcCardModel.ApplicationUserModelId); return(View(nfcCardModel)); }
public async Task <IActionResult> Create([Bind("CardId,ApplicationUserModelId,LastScanDate")] NfcCardModel nfcCardModel) { if (ModelState.IsValid) { _context.Add(nfcCardModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserModelId"] = new SelectList(_context.Users, "Id", "Id", nfcCardModel.ApplicationUserModelId); return(View(nfcCardModel)); }