public PartialViewResult GetLikes(int idpub)
        {
            LikeVM like;
            Like   test = null;

            foreach (Like l in likeserv.GetMany())
            {
                if ((l.idPub == idpub) && (l.idUser.Equals("f43c21cf-f35a-4897-a9e3-343c00afe7b4")))
                {
                    test = l;
                }
            }

            if (test == null)
            {
                return(PartialView("AddLike", new LikeVM {
                    idPub = idpub
                }));
            }
            else
            {
                return(PartialView("DellLike", new LikeVM {
                    idPub = idpub
                }));
            }
        }
 public bool TestLike(Publication p)
 {
     foreach (var like in likeService.GetMany())
     {
         if (like.ParentLike == (int)Session["idu"] && like.PublicationLike == p.PublicationId)
         {
             testLike = true;
         }
     }
     return(testLike);
 }
 public bool TestLike(int idp, int idu)
 {
     foreach (var like in likeService.GetMany())
     {
         if (like.ParentLike == idu && like.PublicationLike == idp)
         {
             testLike = true;
         }
     }
     return(testLike);
 }
Пример #4
0
        public IHttpActionResult AnnulerLike(int idp, int idu)
        {
            Like like  = null;
            var  like1 = likeService.GetMany();

            foreach (var l in like1)
            {
                if (l.ParentLike == idu && l.PublicationLike == idp)
                {
                    like = l;
                }
            }

            likeService.Delete(like);
            likeService.Commit();
            MyService.annul(idp);



            return(Ok());
        }