Exemple #1
0
 public ActionResult Restore(int?id)
 {
     using (var db = new blogEntities1())
     {
         var user = db.Blog.Find(id);
         user.Bactive         = true;
         db.Entry(user).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     //db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemple #2
0
        public ActionResult Create([Bind(Include = "Bid,Bttitle,Bcontent,BCategory,BDate,Bimagen")] Blog blog)
        {
            HttpPostedFileBase file = Request.Files["ImageData"];

            if (file != null)
            {
                byte[] imageBytes = ConvertToBytes(file);
                blog.Bimagen = imageBytes;
            }

            if (ModelState.IsValid)
            {
                blog.Bactive = true;

                db.Blog.Add(blog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(blog));
        }
Exemple #3
0
 public ActionResult DeleteConfirmed(int id)
 {/*
   * Blog blog = db.Blog.Find(id);
   * db.Blog.Remove(blog);
   * var search = from s in db.Blog select s;
   *   Blog bg = new Blog();
   * bg.Bactive = false;
   */
     using (var db = new blogEntities1())
     {
         var user = db.Blog.Find(id);
         user.Bactive         = false;
         db.Entry(user).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     //db.SaveChanges();
     return(RedirectToAction("Index"));
 }