示例#1
0
 public void Downvote(ulong id)
 {
     if (Downvotes.Contains(id))
     {
         return;
     }
     if (Upvotes.Contains(id))
     {
         Upvotes.Remove(id);
     }
     Downvotes.Add(id);
 }
示例#2
0
        public void DownvotePost(User user)
        {
            var isDownvoted = Downvotes.Contains(user);

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