private void HeartBtn_Click(object sender, RoutedEventArgs e) { bool isReacted = CommentDB.IsReacted(ZComment.CommentId, App.CurrentUser); if (isReacted == false) { ZComment.Heart += 1; ZComment.Total += 1; CommentDB.UpdateHeart(ZComment.CommentId, ZComment.Heart); CommentDB.AddReaction(ZComment.CommentId, App.CurrentUser, "heart"); this._myReaction.ReactionType = "heart"; } else if (isReacted) { string currentReaction = CommentDB.GetReaction(ZComment.CommentId, App.CurrentUser); if (currentReaction.Equals("like")) { ZComment.Like -= 1; ZComment.Total -= 1; CommentDB.UpdateLike(ZComment.CommentId, ZComment.Like); } if (currentReaction.Equals("happy")) { ZComment.Happy -= 1; ZComment.Total -= 1; CommentDB.UpdateHappy(ZComment.CommentId, ZComment.Happy); } if (currentReaction.Equals("sad")) { ZComment.Sad -= 1; ZComment.Total -= 1; CommentDB.UpdateSad(ZComment.CommentId, ZComment.Sad); } if (string.IsNullOrEmpty(currentReaction) || !(currentReaction.Equals("heart"))) { ZComment.Heart += 1; ZComment.Total += 1; CommentDB.UpdateHeart(ZComment.CommentId, ZComment.Heart); CommentDB.AddReaction(ZComment.CommentId, App.CurrentUser, "heart"); this._myReaction.ReactionType = "heart"; } } ReactionsPopup.IsOpen = false; }