async public Task <IActionResult> Post([FromBody] Post post, [FromRoute] Guid parentId)
        {
            var related = new PostRelated()
            {
                Current = post
            }.WithParent(parentId);
            await Task.Run(() => _factory.Post(related));

            return(new CreatedResult($"{ControllerContext.HttpContext.Request.Path.ToString()}/{post.Id.ToString()}", post));
        }
Exemple #2
0
 public static PostRelated WithParent(this PostRelated related, Guid parentId = default(Guid))
 {
     related.Parent = new PostRelated()
     {
         Current = new Post()
         {
             Id = parentId
         }
     };
     return(related);
 }