public async Task <IActionResult> Edit(int id, [Bind("Id,Blah,WroteDate,Likes")] Witter witter) { if (id != witter.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(witter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WitterExists(witter.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(witter)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FriendsSince,Job,Portrait")] Friend friend) { if (id != friend.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(friend); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FriendExists(friend.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(friend)); }