Exemplo n.º 1
0
        public async Task <IActionResult> PostContent(string app, string name, [FromBody] NamedContentData request, [FromQuery] bool publish = false)
        {
            await contentQuery.FindSchemaAsync(App, name);

            var command = new CreateContent {
                ContentId = Guid.NewGuid(), Data = request.ToCleaned(), Publish = publish
            };

            var context = await CommandBus.PublishAsync(command);

            var result   = context.Result <EntityCreatedResult <NamedContentData> >();
            var response = ContentDto.Create(command, result);

            return(CreatedAtAction(nameof(GetContent), new { id = command.ContentId }, response));
        }