예제 #1
0
파일: Story.cs 프로젝트: aoki1210/kigg
        public bool Demote(DateTime at, IUser byUser)
        {
            Check.Argument.IsNotNull(byUser, "byUser");

            if (CanDemote(byUser))
            {
                var vote = this.GetVote(byUser);
                this.RemoveVote(vote);
                StoryVotesInternal.Remove((StoryVote)vote);

                LastActivityAt = at;

                return(true);
            }

            return(false);
        }
예제 #2
0
파일: Story.cs 프로젝트: aoki1210/kigg
        public bool Promote(DateTime at, IUser byUser, string fromIpAddress)
        {
            Check.Argument.IsNotNull(byUser, "byUser");

            //Check if user can promote
            if (CanPromote(byUser))
            {
                //Call extension method AddVote, it will perform all parameters validation checks
                var vote = this.AddVote(at, byUser, fromIpAddress);

                //Add created vote to StoryVotes, this should increment votes
                StoryVotesInternal.Add((StoryVote)vote);

                LastActivityAt = at;

                return(true);
            }

            return(false);
        }