public override async Task <PostModel> GetPostById(PostInt request, ServerCallContext context) { Post post = new Post(); post = post.GetPostById(request.Id); PostModel postModel = new PostModel { PostId = post.PostId, Description = post.Description, Domain = post.Domain, Date = post.Date.ToString() }; foreach (Comment com in post.Comments) { CommentModel newCom = new CommentModel { CommentId = com.CommentId, Text = com.Text, PostPostId = com.PostPostId, Post = postModel }; postModel.Comments.Coments.Add(newCom); } return(await Task.FromResult(postModel)); }
public override async Task <PostInt> DeletePost(PostInt request, ServerCallContext context) { Post post = new Post(); return(await Task.FromResult(new PostInt { Id = post.DeletePost(request.Id) })); }