Beispiel #1
0
        /// <summary>
        /// Deletes a comment with a given id
        /// </summary>
        /// <param name="actualRequest">the client request to be handled</param>
        /// <returns>the response to the given request</returns>
        private async Task <ActualRequest> DeleteCommentFromPostAsync(ActualRequest actualRequest)
        {
            Request request   = actualRequest.Request;
            int     commentId = Convert.ToInt32(request.Argument.ToString());

            Console.WriteLine("Deleting comment with id " + commentId);
            bool response = await postRepo.DeleteCommentFromPost(commentId);

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

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