public async Task <IActionResult> Edit(int id, [Bind("ID,name,gender,birthday")] 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)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,title,author,click,like_,post_time,letter")] Board board) { if (id != board.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(board); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BoardExists(board.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(board)); }