public ActionResult Edit(Thread thread) { if (ModelState.IsValid) { db.Entry(thread).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thread)); }
public ActionResult Edit(Post post, int threadid = 0) { if (ModelState.IsValid) { post.ThreadID = threadid; db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { threadidd = threadid })); } return(View(post)); }
public void Update(T entity) { var entry = context.Entry(entity); DbSet.Attach(entity); entry.State = EntityState.Modified; if (!_shareContext) { context.SaveChanges(); } }