Exemple #1
0
        public IHttpActionResult Dislike(int idp, int idu)
        {
            Dislike dislike = new Dislike()
            {
                ParentDislike      = idu,
                PublicationDislike = idp
            };

            dislikeService.Add(dislike);
            dislikeService.Commit();

            MyService.Dislike(idp);
            Like like  = null;
            var  like1 = likeService.GetMany();

            foreach (var l in like1)
            {
                if (l.ParentLike == idu && l.PublicationLike == idp)
                {
                    like = l;
                }
            }
            if (like != null)
            {
                likeService.Delete(like);
                likeService.Commit();
                MyService.annul(idp);
            }
            return(Ok());
        }
        public RedirectToRouteResult Dislike(int id, PublicationVM pubvm, HttpPostedFileBase file)
        {
            Dislike dislike = new Dislike()
            {
                ParentDislike      = (int)Session["idu"],
                PublicationDislike = id
            };

            dislikeService.Add(dislike);
            dislikeService.Commit();

            Service.Dislike(id);
            Like like  = null;
            var  like1 = likeService.GetMany();

            foreach (var l in like1)
            {
                if (l.ParentLike == (int)Session["idu"] && l.PublicationLike == id)
                {
                    like = l;
                }
            }
            if (like != null)
            {
                likeService.Delete(like);
                likeService.Commit();
                Service.annul(id);
            }
            return(RedirectToAction("Index"));
        }