public async Task <IActionResult> Set(String id, String content) { await _workflowCatalog.SaveAsync(new WorkflowDescriptor() { Id = id, Body = content, Format = "text/xml" }); return(new EmptyResult()); }
public async Task <IActionResult> Publish(String id, IFormFile uploadedFile) { if (id == null || uploadedFile == null) { return(View("Error")); } String format = uploadedFile.ContentType switch { "text/xml" => "xaml", "application/octet-stream" => "xaml", _ => throw new InvalidOperationException($"invalid format '{uploadedFile.ContentType}'") }; using var ms = new MemoryStream(); uploadedFile.CopyTo(ms); var text = Encoding.UTF8.GetString(ms.ToArray()); await _catalog.SaveAsync(new WorkflowDescriptor() { Id = id, Body = text, Format = format }); return(Redirect("/")); }