Ejemplo n.º 1
0
        }                                // amount of times it was called.

        public void Upvote(ulong id)
        {
            if (Upvotes.Contains(id))
            {
                return;
            }
            if (Downvotes.Contains(id))
            {
                Downvotes.Remove(id);
            }
            Upvotes.Add(id);
        }
Ejemplo n.º 2
0
        public void UpvotePost(User user)
        {
            var isUpvoted = Upvotes.Contains(user);

            if (!isUpvoted)
            {
                Upvotes.Add(user);
                if (Downvotes.Contains(user))
                {
                    var index = Downvotes.IndexOf(user);
                    Downvotes.RemoveAt(index);
                }
            }
            else
            {
                var index = Upvotes.IndexOf(user);
                Upvotes.RemoveAt(index);
            }
        }