Beispiel #1
0
        public ActionResult Deletelike(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();
                foreach (var item in listf)
                {
                    if (item.idmessage == id && item.iduser == iduser)
                    {
                        l = item;
                    }
                }

                messages messages = Ms.GetById(id);
                messages.nbLike = messages.nbLike - 1;
                Ms.Update(messages);
                Ms.Commit();


                Ls.Delete(l);
                Ls.Commit();
                return(RedirectToAction("ViewTopic", new
                {
                    id = messages.topic.idTopic,
                    idRep = id,
                }));
            }
        }
 public int Delete(int UserId, int ProjectId)
 {
     return(dal.Delete(UserId, ProjectId));
 }