public async Task <IActionResult> Edit(int id, [Bind("AppleId,Name,Model,Year")] Apple apple) { if (id != apple.AppleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apple); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppleExists(apple.AppleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(apple)); }
public async Task<IActionResult> Edit(int id, [Bind("UserId,Name,Password,YearBorn")] Login login) { if (id != login.UserId) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(login); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoginExists(login.UserId)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(login); }