public HttpResponseMessage Operations([FromBody] IEnumerable <string> woids, string op) { var messages = new List <ErrorMessage>(); if (op == WorkflowOperation.Delete.ToString()) { foreach (var o in woids) { var resp = TasksService.DeleteWorkflow(new ControlWorkflowRequest { WorkflowOid = o }); if (resp.Message != "OK") { messages.Add(new ErrorMessage { Id = o, Message = resp.Message }); } } } if (op == WorkflowOperation.Restart.ToString()) { foreach (var o in woids) { var resp = TasksService.ReStartWorkflow(new ReStartWorkflowRequest { OldWorkflowId = o }); if (resp.Message != "OK") { messages.Add(new ErrorMessage { Id = o, Message = resp.Message }); } } } if (op == WorkflowOperation.Terminate.ToString()) { foreach (var o in woids) { var resp = TasksService.CancelWorkflow(new ControlWorkflowRequest { WorkflowOid = o }); if (resp.Message != "OK") { messages.Add(new ErrorMessage { Id = o, Message = resp.Message }); } } } var json = JsonConvert.SerializeObject( messages, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); var result = Request.CreateResponse(HttpStatusCode.OK); result.Content = new StringContent(json, Encoding.UTF8, "text/plain"); return(result); }