Example #1
0
        public virtual ApiLinkTypeServerResponseModel MapEntityToModel(
            LinkType item)
        {
            var model = new ApiLinkTypeServerResponseModel();

            model.SetProperties(item.Id,
                                item.RwType);

            return(model);
        }
        public virtual ApiLinkTypeServerResponseModel MapServerRequestToResponse(
            int id,
            ApiLinkTypeServerRequestModel request)
        {
            var response = new ApiLinkTypeServerResponseModel();

            response.SetProperties(id,
                                   request.RwType);
            return(response);
        }
Example #3
0
        public virtual ApiPostLinkServerResponseModel MapEntityToModel(
            PostLink item)
        {
            var model = new ApiPostLinkServerResponseModel();

            model.SetProperties(item.Id,
                                item.CreationDate,
                                item.LinkTypeId,
                                item.PostId,
                                item.RelatedPostId);
            if (item.LinkTypeIdNavigation != null)
            {
                var linkTypeIdModel = new ApiLinkTypeServerResponseModel();
                linkTypeIdModel.SetProperties(
                    item.LinkTypeIdNavigation.Id,
                    item.LinkTypeIdNavigation.RwType);

                model.SetLinkTypeIdNavigation(linkTypeIdModel);
            }

            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.RelatedPostIdNavigation != null)
            {
                var relatedPostIdModel = new ApiPostServerResponseModel();
                relatedPostIdModel.SetProperties(
                    item.RelatedPostIdNavigation.Id,
                    item.RelatedPostIdNavigation.AcceptedAnswerId,
                    item.RelatedPostIdNavigation.AnswerCount,
                    item.RelatedPostIdNavigation.Body,
                    item.RelatedPostIdNavigation.ClosedDate,
                    item.RelatedPostIdNavigation.CommentCount,
                    item.RelatedPostIdNavigation.CommunityOwnedDate,
                    item.RelatedPostIdNavigation.CreationDate,
                    item.RelatedPostIdNavigation.FavoriteCount,
                    item.RelatedPostIdNavigation.LastActivityDate,
                    item.RelatedPostIdNavigation.LastEditDate,
                    item.RelatedPostIdNavigation.LastEditorDisplayName,
                    item.RelatedPostIdNavigation.LastEditorUserId,
                    item.RelatedPostIdNavigation.OwnerUserId,
                    item.RelatedPostIdNavigation.ParentId,
                    item.RelatedPostIdNavigation.PostTypeId,
                    item.RelatedPostIdNavigation.Score,
                    item.RelatedPostIdNavigation.Tag,
                    item.RelatedPostIdNavigation.Title,
                    item.RelatedPostIdNavigation.ViewCount);

                model.SetRelatedPostIdNavigation(relatedPostIdModel);
            }

            return(model);
        }