public ActionResult Abonner_t(int id)
        {

            if (HttpContext.Session["id"] == null)
            {
                ModelState.AddModelError("", "Vous n'avez plus d'identifiant!");
                return RedirectToAction("Index", "Home");
            }

            access a = new access();
            int id_agent = (int) HttpContext.Session["id"];
            System.Diagnostics.Debug.WriteLine("identifiant en mousse abonnement: " + HttpContext.Session["id"]);

            bool verif1 = true;
            var ret = (from m in _db.Abonnement
                       where m.collaborateur_id == id_agent && m.theme_id == id
                       select m).Count();
            if (ret > 0) { verif1 = false; }

            if (verif1)
            {
                bool verif = a.insert_ab(id, id_agent);
                HttpContext.Session["id"] = id_agent;

                if (verif == false)
                    ModelState.AddModelError("", "Problème d'insertion.");
            }
            return View("Index", _db.Theme.ToList());    
        } 
        public ActionResult Index(int id)
        {
            var msg = (from m in _db.Message
                      where m.theme_id == id
                      select m);

            /****************/

            access da = new access();
            da.maj_stat(id);

            /****************/

            HttpContext.Session["id_theme"] = id;

            return View(msg.ToList());
        }
        public ActionResult Delete(int id)
        {
            if (HttpContext.Session["id"] == null)
            {
                ModelState.AddModelError("", "Vous n'avez plus d'identifiant!");
                return RedirectToAction("Index", "Home");
            }

            access a = new access();
            int id_agent = (int)HttpContext.Session["id"];
            System.Diagnostics.Debug.WriteLine("identifiant en mousse delete: " + HttpContext.Session["id"]);
            bool verif = a.delete_ab(id, id_agent);
            HttpContext.Session["id"] = id_agent;

            if (verif == false)
                ModelState.AddModelError("", "Problème de suppression.");

            return View("Index", _db.Theme.ToList()); 
        }
 public ActionResult Delete(Theme_ themeToDel)
 {
     if (!ModelState.IsValid)
     {
         System.Diagnostics.Debug.WriteLine("bad1");
         return View();
     }
     try
     {
         access da = new access();
         da.delete_tables_ref_theme3(themeToDel.id);
         
         return RedirectToAction("Index");
     }
     catch
     {
         System.Diagnostics.Debug.WriteLine("bad2");
         return View();
     }
 }