Exemple #1
0
        public void DeleteMessage(int id)
        {
            messages m = Ms.GetById(id);

            Ms.Delete(m);
            Ms.Commit();
        }
Exemple #2
0
        public ActionResult AddLike(int id, int iduser)
        {
            if (iduser == 0)
            {
                msg = "Sorry, you have to connect";
                return(RedirectToAction("Login"));
            }
            else
            {
                var   listf = Ls.GetAll();
                likes l     = new likes();
                l.idmessage = id;
                l.iduser    = iduser;

                l.date = DateTime.Now;
                messages messages = Ms.GetById(id);
                messages.nbLike = messages.nbLike + 1;
                Ms.Update(messages);
                Ms.Commit();


                Ls.Add(l);
                Ls.Commit();
                return(RedirectToAction("ViewTopic", new
                {
                    id = id,
                    idRep = id,
                }));
            }
        }