Пример #1
0
        public virtual ApiPostHistoryTypeServerResponseModel MapEntityToModel(
            PostHistoryType item)
        {
            var model = new ApiPostHistoryTypeServerResponseModel();

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

            return(model);
        }
Пример #2
0
        public virtual ApiPostHistoryTypeServerResponseModel MapServerRequestToResponse(
            int id,
            ApiPostHistoryTypeServerRequestModel request)
        {
            var response = new ApiPostHistoryTypeServerResponseModel();

            response.SetProperties(id,
                                   request.RwType);
            return(response);
        }
Пример #3
0
        public virtual ApiPostHistoryServerResponseModel MapEntityToModel(
            PostHistory item)
        {
            var model = new ApiPostHistoryServerResponseModel();

            model.SetProperties(item.Id,
                                item.Comment,
                                item.CreationDate,
                                item.PostHistoryTypeId,
                                item.PostId,
                                item.RevisionGUID,
                                item.Text,
                                item.UserDisplayName,
                                item.UserId);
            if (item.PostHistoryTypeIdNavigation != null)
            {
                var postHistoryTypeIdModel = new ApiPostHistoryTypeServerResponseModel();
                postHistoryTypeIdModel.SetProperties(
                    item.PostHistoryTypeIdNavigation.Id,
                    item.PostHistoryTypeIdNavigation.RwType);

                model.SetPostHistoryTypeIdNavigation(postHistoryTypeIdModel);
            }

            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);
            }

            return(model);
        }