BusinessLogic.Logic.VotableFeatures.VotableFeatureVoter.CastVote C# (CSharp) Method

CastVote() public method

public CastVote ( string votableFeatureId, bool voteUp ) : VotableFeature
votableFeatureId string
voteUp bool
return VotableFeature
        public VotableFeature CastVote(string votableFeatureId, bool voteUp)
        {
            var votableFeature = dataContext.FindById<VotableFeature>(votableFeatureId);

            if (voteUp)
            {
                votableFeature.NumberOfUpvotes += 1;
            }
            else
            {
                votableFeature.NumberOfDownvotes += 1;
            }

            votableFeature.DateModified = DateTime.UtcNow;

            return dataContext.Save(votableFeature, new ApplicationUser());
        }
    }