public ActionResult DeleteConfirmed(int id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            admin_loaitintuc admin_loaitintuc = db.admin_loaitintuc.Find(id);

            //db.admin_loaitintuc.Remove(admin_loaitintuc);
            admin_loaitintuc.ngaycapnhat     = DateTime.Now;
            admin_loaitintuc.daxoa           = true;
            db.Entry(admin_loaitintuc).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,tenloaitintuc,ngaytao,ngaycapnhat,nguoitao,daxoa,hinhanhtintuc,motasoluoc,ghichu")] admin_loaitintuc admin_loaitintuc)
 {
     if (Session["User"] == null)
     {
         return(RedirectToAction("Logout", "Account"));
     }
     if (ModelState.IsValid)
     {
         admin_loaitintuc.ngaycapnhat     = DateTime.Now;
         db.Entry(admin_loaitintuc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(admin_loaitintuc));
 }
        // GET: Admin/LoaiTinTuc/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            admin_loaitintuc admin_loaitintuc = db.admin_loaitintuc.Find(id);

            if (admin_loaitintuc == null)
            {
                return(HttpNotFound());
            }
            return(View(admin_loaitintuc));
        }
        public ActionResult Create([Bind(Include = "id,tenloaitintuc,ngaytao,ngaycapnhat,nguoitao,daxoa,hinhanhtintuc,motasoluoc,ghichu")] admin_loaitintuc admin_loaitintuc)
        {
            if (Session["User"] == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }
            if (ModelState.IsValid)
            {
                if (Session["User"] != null)
                {
                    admin_account u = Session["User"] as admin_account;
                    admin_loaitintuc.nguoitao = u.id;
                }
                admin_loaitintuc.ngaytao     = DateTime.Now;
                admin_loaitintuc.ngaycapnhat = DateTime.Now;
                db.admin_loaitintuc.Add(admin_loaitintuc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(admin_loaitintuc));
        }