Пример #1
0
 public ActionResult Edit(Topic topic)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(topic).State = System.Data.EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(topic));
 }
Пример #2
0
        //
        public ActionResult EditBlog(Blog blogs)
        {
            if (ModelState.IsValid == false)
            {
                return(View(blogs));
            }
            using (var BlogDb = new BlogDb())
            {
                BlogDb.Entry(blogs).State = EntityState.Modified;
                BlogDb.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }