public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Body,Feeling,WordCount,PostedOn")] Entry entry) { if (id != entry.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(entry); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntryExists(entry.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(entry)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,UserName")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }