Exemplo n.º 1
0
        public async Task <IActionResult> Download(String id)
        {
            var wfElem = await _catalog.LoadBodyAsync(id);

            Response.Headers.Add("Content-Disposition", $"{id}.xml");
            return(new ContentResult()
            {
                Content = wfElem.Body,
                ContentType = "text/xml",
            });
        }
        public async Task <IActionResult> Get(String id = null)
        {
            String source;

            if (!String.IsNullOrEmpty(id))
            {
                var elem = await _workflowCatalog.LoadBodyAsync(id);

                source = elem.Body;
            }
            else
            {
                var fi = _host.WebRootFileProvider.GetFileInfo("workflows/default.bpmn");
                source = System.IO.File.ReadAllText(fi.PhysicalPath);
            }
            return(Content(source));
        }
        public async Task <IIdentity> PublishAsync(IWorkflowCatalog catalog, String id)
        {
            if (catalog is SqlServerWorkflowCatalog)
            {
                var prms = new ExpandoObject();
                prms.Set("Id", id);

                var res = await _dbContext.ReadExpandoAsync(null, $"{Definitions.SqlSchema}.[Catalog.Publish]", prms);

                return(new Identity()
                {
                    Id = res.Get <String>("Id"),
                    Version = res.Get <Int32>("Version")
                });
            }
            else
            {
                var wf = await catalog.LoadBodyAsync(id);

                return(await PublishAsync(id, wf.Body, wf.Format));
            }
        }