Exemplo n.º 1
0
        public ActionResult Details(int id, Details de)
        {
            string role = null;

            ViewData["Role"] = "";
            IEnumerable <string> roles = new List <string>();

            roles = ((ClaimsIdentity)User.Identity).Claims
                    .Where(ca => ca.Type == ClaimTypes.Role)
                    .Select(ca => ca.Value);
            foreach (var x in roles)
            {
                role = x;
            }

            if (role != null)
            {
                ViewData["Role"] = role;
            }
            Details d = new Models.Details();

            commentaire c = new commentaire();

            c         = de.Commentaire;
            c.idUser  = User.Identity.GetUserId();
            c.idForum = id;
            comnService.Add(c);
            comnService.Commit();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        // GET: Commentaire/Edit/5
        public ActionResult Edit(int id)
        {
            IUnitOfWork            Uok       = new UnitOfWork(Factory);
            IService <commentaire> jbService = new Service <commentaire>(Uok);
            commentaire            app       = jbService.GetById(id);

            return(View(app));
        }
Exemplo n.º 3
0
        // GET: Commentaire/Delete/5
        //public ActionResult Delete(int id)
        //{
        //    commentaire com = cmS.GetById(id);
        //    if (com == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    CommentaireModels CM= new CommentaireModels()
        //    {
        //        text =com.text,



        //    };

        //    return View(CM);
        //}

        // POST: Commentaire/Delete/5

        public ActionResult Delete(int id)
        {
            commentaire com = cmS.GetById(id);

            cmS.Delete(com);
            cmS.Commit();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        // GET: Commentaire/afficher/id
        public ActionResult afficher(commentaire id, FormCollection collection)
        {
            List <commentaire>     appo      = new List <commentaire>();
            IUnitOfWork            Uok       = new UnitOfWork(Factory);
            IService <commentaire> jbService = new Service <commentaire>(Uok);

            appo = jbService.GetAll().ToList();
            return(View(appo));
        }
Exemplo n.º 5
0
        public ActionResult DeleteCmt(int id)
        {
            commentaire cmt = CmtSer.getById(id);

            CmtSer.Delete(cmt);


            return(RedirectToAction("ListCmt/" + id));
        }
Exemplo n.º 6
0
        // GET: Commentaire/Delete/5
        //public ActionResult Delete(int id)
        //{
        //    commentaire com = cmS.GetById(id);
        //    if (com == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    CommentaireModels CM= new CommentaireModels()
        //    {
        //        text =com.text,



        //    };

        //    return View(CM);
        //}

        // POST: Commentaire/Delete/5

        public ActionResult Delete(int id)
        {
            Session["msg"] = "false";
            commentaire com = cmS.GetById(id);

            cmS.Delete(com);
            cmS.Commit();

            return(RedirectToAction("Index1"));
        }
Exemplo n.º 7
0
        // GET: Commentaire/Create/id/idemp
        public ActionResult Create(int id, int idemp)
        {
            IUnitOfWork            Uok       = new UnitOfWork(Factory);
            IService <commentaire> jbService = new Service <commentaire>(Uok);
            var Model = new commentaire();

            Model.commentaireEvzl360_id = id;
            Model.employecommentaire_id = idemp;

            return(View(Model));
        }
Exemplo n.º 8
0
        // GET: Commentaire/Edit/5
        public ActionResult Edit(int id)
        {
            commentaire com = cmS.GetById(id);

            CommentaireModels CM = new CommentaireModels()
            {
                text = com.text,
                id   = com.id,
            };

            return(View(CM));
        }
Exemplo n.º 9
0
        public ActionResult Edit(int id, CommentaireModels CM)
        {
            commentaire com = cmS.GetById(id);


            com.text = CM.text;

            cmS.Update(com);
            UpdateModel(CM);

            cmS.Commit();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 10
0
        public ActionResult Like(int id)
        {
            commentaire com = cmS.GetById(id);


            com.like += 1;

            cmS.Update(com);


            cmS.Commit();


            return(RedirectToAction("Index1"));
        }
Exemplo n.º 11
0
        // GET: Commentaire/Delete/5
        public ActionResult Delete(int id)
        {
            IUnitOfWork            Uok       = new UnitOfWork(Factory);
            IService <commentaire> jbService = new Service <commentaire>(Uok);
            commentaire            app       = jbService.GetById(id);

            if (app == null)
            {
                return(View("NotFound"));
            }
            else
            {
                return(View(app));
            }
        }
Exemplo n.º 12
0
        public ActionResult DisLike(int id)
        {
            commentaire com = cmS.GetById(id);

            Session["msg"] = "false";

            com.like -= 1;

            cmS.Update(com);


            cmS.Commit();


            return(RedirectToAction("Index1"));
        }
Exemplo n.º 13
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         IUnitOfWork            Uok       = new UnitOfWork(Factory);
         IService <commentaire> jbService = new Service <commentaire>(Uok);
         commentaire            app       = jbService.GetById(id);
         // TODO: Add update logic here
         app.comment = Request.Form["comment"];
         jbService.Commit();
         return(RedirectToAction("Index", new { id = app.id }));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 14
0
        public ActionResult Create2(int id, commentaire c)
        {
            if (ModelState.IsValid)
            {
                IUsersService s1    = new UserService();
                forumthread   forum = FoSer.getById(id);
                User          us    = s1.GetById(1);

                commentaire cmt = new commentaire {
                    date = DateTime.Now, idArticle = forum.idArticle, description = c.description, idUser = us.Id
                };
                CmtSer.Add(cmt);

                return(RedirectToAction("ListCmt/" + id));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 15
0
        public ActionResult Create(String txt)
        {
            Session["msg"] = "false";
            List <String> verif = new List <String>();


            commentaire com = new commentaire()

            {
                user_id   = 2,
                status    = 0,
                like      = 0,
                policy_id = (int)Session["id"],
                text      = txt,

                date = DateTime.Now.ToString("MM/dd/yyyy"),
            };

            {
                Char     delimiter  = ' ';
                String[] substrings = txt.Split(delimiter);
                foreach (var substring in substrings)
                {
                    verif.Add(substring);
                }
            }
            if (verif.Contains("sexe") || verif.Contains("bad") || verif.Contains("chet") || verif.Contains("chet up "))
            {
                Session["msg"] = "true";
                return(RedirectToAction("Index1"));
            }
            else
            {
                Session["msg"] = "false";
                cmS.Add(com);
                cmS.Commit();
                ViewBag.err = "this commentaire contais bad word";

                return(RedirectToAction("Index1"));
            }
        }
Exemplo n.º 16
0
        public ActionResult Create(String txt)
        {
            List <String> verif = new List <String>();


            commentaire com = new commentaire()


            {
                policy_id = 2,
                text      = txt,
                user_id   = 1,
            };

            {
                Char     delimiter  = ' ';
                String[] substrings = txt.Split(delimiter);
                foreach (var substring in substrings)
                {
                    verif.Add(substring);
                }
            }
            if (verif.Contains("asba"))
            {
                ViewBag.MessageErreur = "this commentaire contais bad word";
                return(RedirectToAction("Index"));
            }
            else
            {
                cmS.Add(com);
                cmS.Commit();
                ViewBag.err = "this commentaire contais bad word";

                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 17
0
        public ActionResult Create(commentaire c, int id, int idemp)
        {
            IUnitOfWork            Uok       = new UnitOfWork(Factory);
            IService <commentaire> jbService = new Service <commentaire>(Uok);
            List <commentaire>     appo      = new List <commentaire>();

            appo = jbService.GetAll().ToList();
            for (int i = appo.Count - 1; i >= 0; i--)
            {
                if (appo[i].commentaireEvzl360_id == id && appo[i].employecommentaire_id == idemp)
                {
                    return(View("Exist"));
                }
            }
            c.commentaireEvzl360_id = id;
            c.employecommentaire_id = idemp;
            jbService.Add(c);
            jbService.Commit();
            String y = (string)System.Web.HttpContext.Current.Session["id"].ToString();
            int    x = int.Parse(y);

            ViewBag.idemploye = x;
            return(RedirectToAction("IndexByEmp", new { idemploye = x }));
        }
Exemplo n.º 18
0
 public void Add(commentaire c)
 {
     utwk.CommentRepository.Add(c);
     utwk.Commit();
 }
Exemplo n.º 19
0
 public void Delete(commentaire c)
 {
     utwk.CommentRepository.Delete(c);
     utwk.Commit();
 }