Ejemplo n.º 1
0
        public virtual ApiBadgeServerResponseModel MapEntityToModel(
            Badge item)
        {
            var model = new ApiBadgeServerResponseModel();

            model.SetProperties(item.Id,
                                item.Date,
                                item.Name,
                                item.UserId);
            if (item.UserIdNavigation != null)
            {
                var userIdModel = new ApiUserServerResponseModel();
                userIdModel.SetProperties(
                    item.UserIdNavigation.Id,
                    item.UserIdNavigation.AboutMe,
                    item.UserIdNavigation.AccountId,
                    item.UserIdNavigation.Age,
                    item.UserIdNavigation.CreationDate,
                    item.UserIdNavigation.DisplayName,
                    item.UserIdNavigation.DownVote,
                    item.UserIdNavigation.EmailHash,
                    item.UserIdNavigation.LastAccessDate,
                    item.UserIdNavigation.Location,
                    item.UserIdNavigation.Reputation,
                    item.UserIdNavigation.UpVote,
                    item.UserIdNavigation.View,
                    item.UserIdNavigation.WebsiteUrl);

                model.SetUserIdNavigation(userIdModel);
            }

            return(model);
        }
Ejemplo n.º 2
0
        public virtual ApiUserServerResponseModel MapServerRequestToResponse(
            int id,
            ApiUserServerRequestModel request)
        {
            var response = new ApiUserServerResponseModel();

            response.SetProperties(id,
                                   request.AboutMe,
                                   request.AccountId,
                                   request.Age,
                                   request.CreationDate,
                                   request.DisplayName,
                                   request.DownVote,
                                   request.EmailHash,
                                   request.LastAccessDate,
                                   request.Location,
                                   request.Reputation,
                                   request.UpVote,
                                   request.View,
                                   request.WebsiteUrl);
            return(response);
        }
Ejemplo n.º 3
0
        public virtual ApiUserServerResponseModel MapEntityToModel(
            User item)
        {
            var model = new ApiUserServerResponseModel();

            model.SetProperties(item.Id,
                                item.AboutMe,
                                item.AccountId,
                                item.Age,
                                item.CreationDate,
                                item.DisplayName,
                                item.DownVote,
                                item.EmailHash,
                                item.LastAccessDate,
                                item.Location,
                                item.Reputation,
                                item.UpVote,
                                item.View,
                                item.WebsiteUrl);

            return(model);
        }
Ejemplo n.º 4
0
        public virtual ApiVoteServerResponseModel MapEntityToModel(
            Vote item)
        {
            var model = new ApiVoteServerResponseModel();

            model.SetProperties(item.Id,
                                item.BountyAmount,
                                item.CreationDate,
                                item.PostId,
                                item.UserId,
                                item.VoteTypeId);
            if (item.PostIdNavigation != null)
            {
                var postIdModel = new ApiPostServerResponseModel();
                postIdModel.SetProperties(
                    item.PostIdNavigation.Id,
                    item.PostIdNavigation.AcceptedAnswerId,
                    item.PostIdNavigation.AnswerCount,
                    item.PostIdNavigation.Body,
                    item.PostIdNavigation.ClosedDate,
                    item.PostIdNavigation.CommentCount,
                    item.PostIdNavigation.CommunityOwnedDate,
                    item.PostIdNavigation.CreationDate,
                    item.PostIdNavigation.FavoriteCount,
                    item.PostIdNavigation.LastActivityDate,
                    item.PostIdNavigation.LastEditDate,
                    item.PostIdNavigation.LastEditorDisplayName,
                    item.PostIdNavigation.LastEditorUserId,
                    item.PostIdNavigation.OwnerUserId,
                    item.PostIdNavigation.ParentId,
                    item.PostIdNavigation.PostTypeId,
                    item.PostIdNavigation.Score,
                    item.PostIdNavigation.Tag,
                    item.PostIdNavigation.Title,
                    item.PostIdNavigation.ViewCount);

                model.SetPostIdNavigation(postIdModel);
            }

            if (item.UserIdNavigation != null)
            {
                var userIdModel = new ApiUserServerResponseModel();
                userIdModel.SetProperties(
                    item.UserIdNavigation.Id,
                    item.UserIdNavigation.AboutMe,
                    item.UserIdNavigation.AccountId,
                    item.UserIdNavigation.Age,
                    item.UserIdNavigation.CreationDate,
                    item.UserIdNavigation.DisplayName,
                    item.UserIdNavigation.DownVote,
                    item.UserIdNavigation.EmailHash,
                    item.UserIdNavigation.LastAccessDate,
                    item.UserIdNavigation.Location,
                    item.UserIdNavigation.Reputation,
                    item.UserIdNavigation.UpVote,
                    item.UserIdNavigation.View,
                    item.UserIdNavigation.WebsiteUrl);

                model.SetUserIdNavigation(userIdModel);
            }

            if (item.VoteTypeIdNavigation != null)
            {
                var voteTypeIdModel = new ApiVoteTypeServerResponseModel();
                voteTypeIdModel.SetProperties(
                    item.VoteTypeIdNavigation.Id,
                    item.VoteTypeIdNavigation.Name);

                model.SetVoteTypeIdNavigation(voteTypeIdModel);
            }

            return(model);
        }