Esempio n. 1
0
        public virtual ApiPostResponseModel MapRequestToResponse(
            int id,
            ApiPostRequestModel request)
        {
            var response = new ApiPostResponseModel();

            response.SetProperties(id,
                                   request.AcceptedAnswerId,
                                   request.AnswerCount,
                                   request.Body,
                                   request.ClosedDate,
                                   request.CommentCount,
                                   request.CommunityOwnedDate,
                                   request.CreationDate,
                                   request.FavoriteCount,
                                   request.LastActivityDate,
                                   request.LastEditDate,
                                   request.LastEditorDisplayName,
                                   request.LastEditorUserId,
                                   request.OwnerUserId,
                                   request.ParentId,
                                   request.PostTypeId,
                                   request.Score,
                                   request.Tag,
                                   request.Title,
                                   request.ViewCount);
            return(response);
        }
Esempio n. 2
0
        public JsonPatchDocument <ApiPostRequestModel> CreatePatch(ApiPostRequestModel model)
        {
            var patch = new JsonPatchDocument <ApiPostRequestModel>();

            patch.Replace(x => x.AcceptedAnswerId, model.AcceptedAnswerId);
            patch.Replace(x => x.AnswerCount, model.AnswerCount);
            patch.Replace(x => x.Body, model.Body);
            patch.Replace(x => x.ClosedDate, model.ClosedDate);
            patch.Replace(x => x.CommentCount, model.CommentCount);
            patch.Replace(x => x.CommunityOwnedDate, model.CommunityOwnedDate);
            patch.Replace(x => x.CreationDate, model.CreationDate);
            patch.Replace(x => x.FavoriteCount, model.FavoriteCount);
            patch.Replace(x => x.LastActivityDate, model.LastActivityDate);
            patch.Replace(x => x.LastEditDate, model.LastEditDate);
            patch.Replace(x => x.LastEditorDisplayName, model.LastEditorDisplayName);
            patch.Replace(x => x.LastEditorUserId, model.LastEditorUserId);
            patch.Replace(x => x.OwnerUserId, model.OwnerUserId);
            patch.Replace(x => x.ParentId, model.ParentId);
            patch.Replace(x => x.PostTypeId, model.PostTypeId);
            patch.Replace(x => x.Score, model.Score);
            patch.Replace(x => x.Tag, model.Tag);
            patch.Replace(x => x.Title, model.Title);
            patch.Replace(x => x.ViewCount, model.ViewCount);
            return(patch);
        }