Esempio n. 1
0
 public ActionResult Edit(Thread thread)
 {
     if (ModelState.IsValid)
     {
         db.Entry(thread).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(thread));
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        public void Update(T entity)
        {
            var entry = context.Entry(entity);

            DbSet.Attach(entity);

            entry.State = EntityState.Modified;
            if (!_shareContext)
            {
                context.SaveChanges();
            }
        }