Example #1
0
        public IActionResult SetLike(int id, bool isLike)
        {
            int count = -1;

            if (User.Identity.GetUserId() == null)
            {
                return(Json(new { count }));
            }
            else
            {
                count = isLike?
                        LikeRepository.RemoveLike(User.Identity.GetUserId(), id) :
                        LikeRepository.SetLike(User.Identity.GetUserId(), id);
                return(Json(new { count }));
            }
        }