public async Task <IActionResult> Edit(int id, [Bind("Id,Author,Title,City,Publisher,Year,Tags,Content,TimeStamp,userEmail")] Message message) { if (id != message.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(message); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessageExists(message.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(message)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Content,TimeStamp,userEmail")] Post post) { if (id != post.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(post); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(post.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(post)); }