public async Task <IActionResult> Edit(int id, [Bind("ID,Content,CreatedOn,PostID,AuthorID")] Reply reply) { if (id != reply.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reply); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReplyExists(reply.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AuthorID"] = new SelectList(_context.Set <User>(), "Id", "Id", reply.AuthorID); ViewData["PostID"] = new SelectList(_context.Posts, "ID", "ID", reply.PostID); return(View(reply)); }
public void UpdatePost(Post post) { context.Update(post); context.SaveChanges(); }
public void UpdateNews(News news) { context.Update(news); context.SaveChanges(); }
public void UpdateTopic(Topic topic) { context.Update(topic); context.SaveChanges(); }