public async Task <IActionResult> CreateNewVersion(string app, string name, Guid id) { await contentQuery.FindSchemaAsync(App, name); var command = new CreateNewVersion() { ContentId = id }; await CommandBus.PublishAsync(command); var(schema, entity) = await contentQuery.FindContentAsync(App, name, User, id, latest : true); var response = SimpleMapper.Map(entity, new ContentDto()); if (entity.Data != null) { var isFrontendClient = User.IsFrontendClient(); response.Data = entity.Data.ToApiModel(schema.SchemaDef, App.LanguagesConfig, !isFrontendClient); } Response.Headers["ETag"] = entity.Version.ToString(); Response.Headers["Surrogate-Key"] = entity.Id.ToString(); return(Ok(response)); }
public void CreateNewVersion(CreateNewVersion command) { RaiseEvent(SimpleMapper.Map(command, new ContentNewVersionCreated())); }