Exemplo n.º 1
0
        // GET: Like
        public ActionResult Add(int postid, string userid)
        {
            Like like = new Like()
            {
                PostID = postid,
                UserID = userid,
                Status = 1
            };

            repository.Add(like);
            repository.SaveChanges();
            return(RedirectToAction("List", "NewsFeed"));
        }
Exemplo n.º 2
0
        public bool LikePost(LIKE like, int postOwnerID)
        {
            bool returnValue = false;
            var  getLike     = likeRepo.Get(x => x.POST_ID == like.POST_ID && x.LIKE_BY == like.LIKE_BY);

            if (getLike == null)
            {
                returnValue = likeRepo.Add(like);

                if (postOwnerID != like.LIKE_BY)
                {
                    notifManager.AddNotification(new NOTIFICATION()
                    {
                        RECEIVER_ID = postOwnerID,
                        SEEN        = "N",
                        SENDER_ID   = like.LIKE_BY,
                        NOTIF_TYPE  = "L",
                        POST_ID     = like.POST_ID
                    });
                }
            }

            return(returnValue);
        }