Exemple #1
0
        /// <summary>
        /// Adds a given comment to a given post
        /// </summary>
        /// <param name="actualRequest">the client request to be handled</param>
        /// <returns>the response to the given request</returns>
        private async Task <ActualRequest> AddCommentToPostAsync(ActualRequest actualRequest)
        {
            CommentForPost comment =
                JsonSerializer.Deserialize <CommentForPost>(actualRequest.Request.Argument.ToString());
            int createdCommentId = await postRepo.AddCommentToPost(comment);

            Request responseRequest = new Request
            {
                ActionType = ActionType.POST_ADD_COMMENT.ToString(),
                Argument   = JsonSerializer.Serialize(createdCommentId)
            };

            return(new ActualRequest
            {
                Request = responseRequest,
                Images = null
            });
        }