Example #1
0
        public async Task <IActionResult> LikeComment(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var  data        = _comment.CommentById(id);
            var  userId      = _userManager.GetUserId(this.HttpContext.User);
            bool likeComment = await _comment.CommentLike(data, userId);

            //data.SongLike += 1;
            if (likeComment)
            {
                TempData["LikeAlert"]        = true;
                TempData["AlreadyLikeAlert"] = false;
                return(RedirectToAction("GetSong", "Song", new { id = data.SongId }));
            }

            TempData["LikeAlert"]        = false;
            TempData["AlreadyLikeAlert"] = true;
            return(RedirectToAction("GetSong", "Song", new { id = data.SongId }));
        }