public IHttpActionResult ResubmitWorkflowTask(TaskData model) { WorkflowInstancePoco instance = GetInstance(model.InstanceGuid); try { WorkflowProcess process = GetProcess(instance.Type); IUser currentUser = _utility.GetCurrentUser(); instance = process.ResubmitWorkflow( instance, currentUser.Id, model.Comment ); Log.Info($"{instance.TypeDescription} request for {instance.Node.Name} [{instance.NodeId}] was resubmitted by {currentUser.Name}"); return(Json(new { message = $"Changes resubmitted successfully. Page will be {instance.TypeDescriptionPastTense.ToLower()} following workflow completion.", status = 200 }, ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = $"An error occurred processing the approval on {instance.Node.Name} [{instance.NodeId}]"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }
public IHttpActionResult ResubmitWorkflowTask(TaskData model) { WorkflowInstancePoco instance = _instancesService.GetPopulatedInstance(model.InstanceGuid); WorkflowProcess process = instance.GetProcess(); try { IUser currentUser = _utility.GetCurrentUser(); instance = process.ResubmitWorkflow( instance, currentUser.Id, model.Comment ); string typeDescription = instance.WorkflowType.Description(instance.ScheduledDate); string typeDescriptionPast = instance.WorkflowType.DescriptionPastTense(instance.ScheduledDate); Log.Info($"{typeDescription} request for {instance.Node.Name} [{instance.NodeId}] was resubmitted by {currentUser.Name}"); _hubContext.Clients.All.TaskResubmitted( _tasksService.ConvertToWorkflowTaskList(instance.TaskInstances.ToList(), instance: instance)); return(Json(new { message = $"Changes resubmitted successfully. Page will be {typeDescriptionPast.ToLower()} following workflow completion.", status = 200, notifications = NotificationHelpers.MapEventMessagesToNotifications(process.EventMessages) }, ViewHelpers.CamelCase)); } catch (UmbracoOperationFailedException e) { string msg = $"A Publishing failure occurred processing the approval on {instance.Node.Name} [{instance.Node.Id}]"; Log.Error(msg, e); return(Json(new { message = msg, status = 200, isUmbracoOperationError = true, notifications = NotificationHelpers.MapEventMessagesToNotifications(process.EventMessages) } , ViewHelpers.CamelCase)); } catch (Exception ex) { string msg = $"An error occurred processing the approval on {instance.Node.Name} [{instance.NodeId}]"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }