예제 #1
0
        public ScoredPostDto FromScoredPostToScoredPostDto(ScoredPost scoredPost)
        {
            ScoredPostDto scoredPostDto = new ScoredPostDto()
            {
                UserId = scoredPost.UserId,
                PostId = scoredPost.PostId
            };

            if (scoredPost.Score)
            {
                scoredPostDto.Type = ScoreTypes.Positive;
            }
            else
            {
                scoredPostDto.Type = ScoreTypes.Negative;
            }

            return(scoredPostDto);
        }
예제 #2
0
        public ScoredPost FromScoredPostDtoToScoredPost(ScoredPostDto scoredPostDto)
        {
            ScoredPost scoredPost = new ScoredPost()
            {
                PostId = scoredPostDto.PostId,
                UserId = scoredPostDto.UserId
            };

            switch (scoredPostDto.Type)
            {
            case ScoreTypes.Positive:
                scoredPost.Score = true;
                break;

            case ScoreTypes.Negative:
                scoredPost.Score = false;
                break;
            }
            return(scoredPost);
        }
예제 #3
0
        private void AddScoredPost(int postId, int userId, ScoreTypes type)
        {
            ScoredPost scoredPost = new ScoredPost()
            {
                PostId = postId,
                UserId = userId
            };

            switch (type)
            {
            case ScoreTypes.Positive:
                scoredPost.Score = true;
                break;

            case ScoreTypes.Negative:
                scoredPost.Score = false;
                break;
            }
            postManager.AddScoredPost(scoredPost);
        }