public HttpResponseMessage Reject(NotificationDTO postData) { try { var notification = NotificationsController.Instance.GetNotification(postData.NotificationId); if (notification != null) { if (string.IsNullOrEmpty(notification.Context)) { return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" })); } string[] parameters = notification.Context.Split(':'); var stateTransiction = new StateTransaction { ContentItemId = int.Parse(parameters[0]), CurrentStateId = int.Parse(parameters[2]), Message = new StateTransactionMessage(), UserId = UserInfo.UserID }; _workflowEngine.DiscardState(stateTransiction); return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" })); } } catch (Exception exc) { Exceptions.LogException(exc); } return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "unable to process notification")); }
public void DiscardState(ContentItem contentItem, string comment) { StateTransaction stateTransaction = new StateTransaction { ContentItemId = contentItem.ContentItemId, CurrentStateId = contentItem.StateID, Message = new StateTransactionMessage { UserComment = comment }, UserId = _userController.GetCurrentUserInfo().UserID }; _workflowEngine.DiscardState(stateTransaction); }