Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public static PostRelated WithParent(this PostRelated related, Guid parentId = default(Guid))
 {
     related.Parent = new PostRelated()
     {
         Current = new Post()
         {
             Id = parentId
         }
     };
     return(related);
 }